Skip to content

Instantly share code, notes, and snippets.

@marckean
Created July 26, 2017 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marckean/386b7d03fa4e028014d5b4b07f5ac6a7 to your computer and use it in GitHub Desktop.
Save marckean/386b7d03fa4e028014d5b4b07f5ac6a7 to your computer and use it in GitHub Desktop.
### Log into Azure using certificate authentication
$AzureADAppID = '49fy7934-dc71-4bdd-8804-h9742fyh93y'
$certThumbprint = (Get-ChildItem Cert:\LocalMachine\My | where {$_.Subject -match 'PowerShell_SP'}).ThumbPrint
$TenantId = '3494h480-6a11-78k0-a439-49hh8f49d0'
Login-AzureRmAccount -ServicePrincipal -TenantId $tenantId -ApplicationId $AzureADAppId -CertificateThumbprint $certThumbprint
$Subscription = (Get-AzureRmSubscription | Out-GridView -Title "Choose a Source & Target Subscription ..." -PassThru)
Select-AzureRmSubscription -SubscriptionId $Subscription.Id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment