Last active
August 9, 2018 11:49
-
-
Save eosfor/42f437d8230a7527abfdc3c0d34ee10c to your computer and use it in GitHub Desktop.
When you accidentally deleted password of a security 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
$passwords = "<pwd1>", | |
"<pwd2>", | |
"<pwd3>" | |
$keys = $passwords | % { | |
$sDate = Get-Date | |
$eDate = $sDate.AddYears(10) | |
$kID = (New-Guid).Guid | |
$value = $_ | |
$keydata = [Microsoft.Azure.Graph.RBAC.Version1_6.Models.PasswordCredential]::new($sDate, $eDate, $kID, $value) | |
$keydata | |
} | |
Update-AzureRmADServicePrincipal -ApplicationId "<some guid>" -PasswordCredential $keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment