如何使用Azure PowerShell创建PasswordCredentials对象并传入新的AzADApplication
我想用密码凭据创建Azure Active Directory应用程序。以下文档使用密码而不是密码凭据 有谁能建议我如何使用Az模块创建PasswordCredentials对象并传入如何使用Azure PowerShell创建PasswordCredentials对象并传入新的AzADApplication,azure,powershell,azure-active-directory,azure-powershell,Azure,Powershell,Azure Active Directory,Azure Powershell,我想用密码凭据创建Azure Active Directory应用程序。以下文档使用密码而不是密码凭据 有谁能建议我如何使用Az模块创建PasswordCredentials对象并传入新的AzADApplication New-AzADApplication -DisplayName "xxx" -IdentifierUris "xxx" -PasswordCredentials 请尝试以下操作: $passwordCred = [Microsoft.Azure.Commands.Activ
新的AzADApplication
New-AzADApplication -DisplayName "xxx" -IdentifierUris "xxx" -PasswordCredentials
请尝试以下操作:
$passwordCred = [Microsoft.Azure.Commands.ActiveDirectory.PSADPasswordCredential]@{
"StartDate" = [DateTime]::UtcNow
"EndDate" = [DateTime]::UtcNow.AddYears(1)
"Password" = "{password-here}"
}
New-AzADApplication -DisplayName "My_app" `
-IdentifierUris "https://example.com/api" `
-PasswordCredentials @($passwordCred)
从类型名称中,我猜@MathiasR.Jessen New AzureDapplication是新Az模块的一部分,而不是AzureRM,对于新脚本,我使用的是Az,所以这不会有帮助,也许会有帮助?@Theo如果你查看代码,它使用的是新AzureDapplication,我在问题和评论中提到,我需要Az示例而不是AzureRM,所以链接不会有帮助,我的意思只是创建
PSADPasswordCredential
的部分。跳过最后4行