Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Azure PowerShell创建PasswordCredentials对象并传入新的AzADApplication_Azure_Powershell_Azure Active Directory_Azure Powershell - Fatal编程技术网

如何使用Azure PowerShell创建PasswordCredentials对象并传入新的AzADApplication

如何使用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

我想用密码凭据创建Azure Active Directory应用程序。以下文档使用密码而不是密码凭据

有谁能建议我如何使用Az模块创建PasswordCredentials对象并传入
新的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行