Created
February 20, 2024 22:21
-
-
Save clarenceb/f44a6e808bbd6a57a3a5e1f552fa5c78 to your computer and use it in GitHub Desktop.
WSL2 login to Azure Subscription for Azure CLI using Windows browser and Azure AD SSO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TENANT="<your-tenant>.onmicrosoft.com" | |
SUBSCRIPTION_ID="<your-azure-subscription-id>" | |
BROWSER="/usr/bin/wslview" | |
export BROWSER | |
# Fix WSL2 clock synchronisation drift which commonly occurs | |
sudo ntpdate pool.ntp.org | |
az login --tenant $TENANT | |
az account set -s $SUBSCRIPTION_ID | |
banner Resource Groups | |
az group list -o table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment