Skip to content

Instantly share code, notes, and snippets.

@dansecops
Created August 10, 2020 14:37
Show Gist options
  • Save dansecops/3eac17b810dd8f6c70ab72acf27b5101 to your computer and use it in GitHub Desktop.
Save dansecops/3eac17b810dd8f6c70ab72acf27b5101 to your computer and use it in GitHub Desktop.
Az-Connect using Service Principal
$azureApplicationId ="<app registration ID>"
$azureTenantId= "<tenant ID>"
$secret = "<secret>"
$azureSecret = ConvertTo-SecureString "$secret" -AsPlainText -Force
$psCred = New-Object System.Management.Automation.PSCredential($azureApplicationId , $azureSecret)
Clear-AzContext -Force
Connect-AzAccount -Credential $psCred -TenantId $azureTenantId -ServicePrincipal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment