I want to create a secret in PowerShell for an Azure Service Principal App.
I have the following code but returns an error:
New-AzADAppCredential: A parameter cannot be found that matches parameter name 'PasswordCredentials'
$appId = "<Service Principal ID>"
$AADApp = Get-AzADApplication -ApplicationId $appId
$PasswordCedentials = @{
StartDateTime = Get-Date
EndDateTime = (Get-Date).AddDays(90)
DisplayName = ("Secret auto-rotated on: "+(Get-Date).ToUniversalTime().ToString("yyyy'-'MM'-'dd"))
}
$Secret = New-AzADAppCredential -ApplicationObject $AADApp -PasswordCredentials $PasswordCedentials
After creation, I want to use this secret and store it into the Key Vault using Azure PowerShell