Created
January 3, 2020 09:58
-
-
Save weeyin83/52c91d2394a67c813927582b102b895d to your computer and use it in GitHub Desktop.
Create an Azure Service Principal in PowerShell
This file contains 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
# Create the Service Principal, generates a random password | |
$sp = New-AzADServicePrincipal -DisplayName ServicePrincipalName | |
# Export the random password that was generated on creation | |
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($sp.Secret) | |
$UnsecureSecret = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) | |
$UnsecureSecret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment