Skip to content

Instantly share code, notes, and snippets.

@Zazcallabah
Created December 3, 2018 11:26
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 Zazcallabah/6528d4bf579e8cd017d4375d3e96fb25 to your computer and use it in GitHub Desktop.
Save Zazcallabah/6528d4bf579e8cd017d4375d3e96fb25 to your computer and use it in GitHub Desktop.
Azure Service Principal Login
$uri = "https://login.microsoftonline.com/$($tenant)/oauth2/token"
$data = @{
"resource"="https://management.core.windows.net/";
"client_id"=$servicePrincipalGuid;
"client_secret"=$secret;
"grant_type"="client_credentials";
}
return Invoke-WebRequest -Method POST -Uri $uri -Headers $headers -Body $data | ConvertFrom-Json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment