Created
June 24, 2020 08:19
-
-
Save dollarpo7/364bb7796587c5356aaa4de7646f3bff to your computer and use it in GitHub Desktop.
PS Function that creates an Azure Service Principal
This file contains hidden or 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
| function New-Sp { | |
| param($Name, $Password) | |
| $spParams = @{ | |
| StartDate = Get-Date | |
| EndDate = Get-Date -Year 2030 | |
| Password = $Password | |
| } | |
| $cred= New-Object Microsoft.Azure.Commands.ActiveDirectory.PSADPasswordCredential -Property $spParams | |
| $sp = New-AzAdServicePrincipal -DisplayName $Name -PasswordCredential $cred | |
| Write-Output $sp | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment