Skip to content

Instantly share code, notes, and snippets.

@maxali
Created October 24, 2019 11:40
Show Gist options
  • Save maxali/8d024235380bc8075ae8a1e0e11cf5b9 to your computer and use it in GitHub Desktop.
Save maxali/8d024235380bc8075ae8a1e0e11cf5b9 to your computer and use it in GitHub Desktop.
Connect-AzureRmAccount Cmdlet using Service Principal with Credential
$applicationId = "<your application ID goes here>";
$securePassword = "<your password goes here>" | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $applicationId, $securePassword
Connect-AzureRmAccount -ServicePrincipal -Credential $credential -TenantId "tenantId"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment