### Install AzureAuth on Windows Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/README.md Installs AzureAuth using a PowerShell script. Sets the version and installation directory via environment variables. Ensure to relaunch applications for PATH changes to take effect. ```powershell # 0.9.5 is an example. See https://github.com/AzureAD/microsoft-authentication-cli/releases for the latest. $env:AZUREAUTH_VERSION = '0.9.5' $script = "${env:TEMP}\install.ps1" $url = "https://raw.githubusercontent.com/AzureAD/microsoft-authentication-cli/${env:AZUREAUTH_VERSION}/install/install.ps1" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Invoke-WebRequest $url -OutFile $script; if ($?) { &$script }; if ($?) { rm $script } ``` -------------------------------- ### Authenticate Client to Resource Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md A general command example for authenticating a client to a specific resource within a tenant, specifying the output format. ```bash azureauth aad --client --resource --tenant --output ``` -------------------------------- ### Get Authentication Status and Cache Info Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Use the `--output status` option to get information about the authentication status and the cache. ```bash azureauth aad --alias alias1 --output status ``` -------------------------------- ### Install AzureAuth CLI on Linux Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/README.md Use this script to install the AzureAuth CLI on Linux. Ensure you set the AZUREAUTH_VERSION environment variable to the desired release. The script requires sudo permissions. ```bash # 0.9.5 is an example. See https://github.com/AzureAD/microsoft-authentication-cli/releases for the latest. export AZUREAUTH_VERSION='0.9.5' curl -sL https://raw.githubusercontent.com/AzureAD/microsoft-authentication-cli/$AZUREAUTH_VERSION/install/linux-install.sh | sh ``` -------------------------------- ### Install AzureAuth on macOS Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/README.md Installs AzureAuth using a shell script. Sets the version via an environment variable. Updates shell profiles for PATH changes; relaunch applications or source profile to apply. ```bash # 0.9.5 is an example. See https://github.com/AzureAD/microsoft-authentication-cli/releases for the latest. export AZUREAUTH_VERSION='0.9.5' curl -sL https://raw.githubusercontent.com/AzureAD/microsoft-authentication-cli/$AZUREAUTH_VERSION/install/install.sh | sh ``` -------------------------------- ### Install Artifacts Credential Provider Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Download and install the Artifacts Credential Provider plugin for .NET on macOS using a curl script. ```shell curl -fsSL https://aka.ms/install-artifacts-credprovider.sh | sh ``` -------------------------------- ### AzureAuth CLI Example with Broker Mode Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Authenticate using the broker mode, which leverages WAM on Windows or Enterprise SSO Extension on macOS. This requires specific configurations and client/resource/tenant IDs. ```bash azureauth aad --client --resource --tenant --mode broker ``` ```bash azureauth aad --client --resource --tenant --mode broker --mode web ``` -------------------------------- ### Configure AzureAuth CLI with Alias Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Define aliases in a configuration file to simplify authentication commands. This example shows how to set up an alias named 'alias2' with specific client, domain, and tenant configurations. ```toml client = "73e5793e-8f71-4da2-9f71-575cb3019b37" domain = "contoso.com" tenant = "a3be859b-7f9a-4955-98ed-f3602dbd954c" [alias.alias2] resource = "ab7e45b7-ea4c-458c-97bd-670ccb543376" client = "73e5793e-8f71-4da2-9f71-575cb3019b37" domain = "fabrikam.com" tenant = "a3be859b-7f9a-4955-98ed-f3602dbd954c" ``` -------------------------------- ### Get Token in Plain Text Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Use the `--output token` option to retrieve only the authentication token in plain text. ```bash azureauth aad --alias alias1 --output token ``` -------------------------------- ### Get Token as JSON Object Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Use the `--output json` option to receive a JSON string containing user details, display name, token, and expiration date. ```bash azureauth aad --alias alias1 --output json ``` -------------------------------- ### Get Azure DevOps Token with Output Formatting Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Combine `azureauth ado token` with the `--output header` option to automatically format the token for `Authorization: Bearer` or `Authorization: Basic` headers, respecting PATs from environment variables. ```bash azureauth ado token --output header ``` -------------------------------- ### Get Azure DevOps Token (Default) Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md The `azureauth ado token` subcommand provides a default Azure DevOps token, functioning similarly to `azureauth aad` with Azure DevOps specific defaults. ```bash azureauth ado token ``` -------------------------------- ### Open Solution in Windows Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Launch the solution file in Visual Studio on Windows to begin development. ```shell start AzureAuth.sln ``` -------------------------------- ### Build the Project with .NET CLI Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Compile the project using the .NET CLI. This is a common step before running or testing. ```shell dotnet build ``` -------------------------------- ### Run Benchmark Project Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Execute the benchmark project in release mode using the .NET CLI. Ensure the correct project path is specified. ```shell dotnet run --configuration release --project .\src\MSALWrapper.Benchmark ``` -------------------------------- ### Run Specific Benchmark with .NET CLI Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Run a specific benchmark within the project by specifying the StartupObject property. This is useful when multiple benchmarks exist. ```shell dotnet run --configuration release --project .\src\MSALWrapper.Benchmark --property:StartupObject=Microsoft.Authentication.MSALWrapper.Benchmark.BrokerBenchmark ``` -------------------------------- ### Run Project with .NET CLI on macOS Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Run the authentication CLI project on macOS using the .NET CLI. Replace placeholders with actual options. ```shell dotnet run --project AzureAuth -- ${more_options_go_here} ``` -------------------------------- ### AzureAuth TOML Configuration File Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Sample TOML configuration file for AzureAuth, demonstrating how to set an alias with a resource ID. This allows implicit provision of arguments. ```toml [alias.alias1] # The resource ID resource = "67eeda51-3891-4101-a0e3-bf0c64047157" ``` -------------------------------- ### Clone the Repository Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Use this command to clone the authentication CLI repository to your local machine. ```git git clone https://github.com/AzureAD/microsoft-authentication-cli ``` -------------------------------- ### Run Auth CLI with .NET CLI Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Build and run the authentication CLI using the .NET CLI. The `--` separates dotnet arguments from application arguments. ```shell dotnet run --project src\AzureAuth -- --help ``` -------------------------------- ### Run Tests with .NET CLI Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Execute all project tests using the .NET CLI's test command. ```shell dotnet test ``` -------------------------------- ### Configure System Web Browser Redirect URI Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Use 'http://localhost' as the redirect URI for system web browser authentication. Do not use 'https' for local redirects. ```text http://localhost ``` -------------------------------- ### Download and Run AzureAuth Uninstall Script Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/uninstall.md Use this PowerShell command to download the uninstall script from GitHub, execute it, and then remove the script file. Ensure TLS 1.2 is enabled for secure download. ```PowerShell $script = "${env:TEMP}\uninstall.ps1" $url = "https://raw.githubusercontent.com/AzureAD/microsoft-authentication-cli/main/install/uninstall.ps1" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Invoke-WebRequest $url -OutFile $script; if ($?) { &$script }; if ($?) { rm $script } ``` -------------------------------- ### Authenticate using Alias with Config File Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Use the `azureauth aad` command with a specified alias and configuration file path to authenticate. ```bash azureauth aad --alias alias1 --config ``` -------------------------------- ### Configure WAM Redirect URI Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Specify this custom redirect URI for Windows Broker (WAM) authentication. ```text ms-appx-web://Microsoft.AAD.BrokerPlugin/ ``` -------------------------------- ### Interactive Restore with .NET CLI Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/CONTRIBUTING.md Perform a .NET restore operation interactively, which may prompt for device code flow authentication. ```shell dotnet restore --interactive ``` -------------------------------- ### Create and Cache Azure DevOps PAT Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Use the `azureauth ado pat` subcommand to create and cache a Personal Access Token (PAT) for Azure DevOps. Requires organization, display name, scope, and a prompt hint. ```bash azureauth ado pat --organization Contoso --display-name NuGetPackages --scope vso.packaging --prompt-hint NuGetPackages ``` -------------------------------- ### Authenticate using Alias with Environment Variable Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md If the `AZUREAUTH_CONFIG` environment variable is set, you can omit the `--config` option when using an alias. ```bash azureauth aad --alias alias1 ``` -------------------------------- ### Set Custom Timeout for Authentication Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Override the default 15-minute timeout using the `--timeout` option. The value is in decimal minutes; 10.75 represents 10 minutes and 45 seconds. ```bash azureauth aad --alias alias1 --timeout 10.75 ``` -------------------------------- ### Configure macOS Enterprise SSO Extension Redirect URI Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Specify this custom redirect URI for macOS Enterprise SSO Extension authentication. Ensure Company Portal is up-to-date and the device is MDM-compliant for brokered authentication. ```text msauth.com.msauth.unsignedapp://auth ``` -------------------------------- ### Disable Output Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Use the `--output none` option to prevent any output from the command. ```bash azureauth aad --alias alias1 --output none ``` -------------------------------- ### JSON Output Format for Azure AD Authentication Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md This JSON structure is returned when using the `--output json` option with `azureauth aad`. It includes user, display name, token, and expiration date. ```json { "user": "", "display_name": "User Name", "token": "", "expiration_date": "" } ``` -------------------------------- ### Reset Telemetry Device ID Source: https://github.com/azuread/microsoft-authentication-cli/blob/main/docs/usage.md Use the `azureauth info reset-device-id` command to reset the telemetry device ID. This ID is used only when telemetry is enabled. ```bash azureauth info reset-device-id ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.