【问题标题】:How to remove identifierUris using PowerShell in Azure Active Directory Application如何在 Azure Active Directory 应用程序中使用 PowerShell 删除 identifierUris
【发布时间】:2019-05-16 11:24:16
【问题描述】:

我正在关注这篇文章https://blogs.msdn.microsoft.com/azuresqldbsupport/2017/09/01/how-to-create-an-azure-ad-application-in-powershell/ 使用PowerShell 创建Azure Active Directory Application 但它失败了,因为identifierUris 已经存在。

$appName = "yourappname123"
$uri = "http://yourappname123"
$secret = "yoursecret123"

$azureAdApplication = New-AzADApplication -DisplayName $appName -HomePage $Uri -IdentifierUris $Uri -Password $(ConvertTo-SecureString -String $secret -AsPlainText -Force)

是否可以在创建应用程序之前删除标识符或在创建应用程序之前验证是否存在标识符Uri

【问题讨论】:

  • 您可以使用Get-AzADApplication -IdentifierUri $uri 来测试是否已经存在具有该IdentifierUri 的应用程序,如果需要使用Update-AzADApplication 更改该应用程序IdentifierUri。顺便说一句..这似乎是您的earlier question 的扩展,您收到了两个答案。你从来没有accepted这些答案之一或提供任何反馈..
  • @Theo。这就是我需要的。谢谢!事实上,这就是我在上一个问题中寻找的内容
  • @Theo 您可以添加您的评论作为帮助他人的答案,谢谢。
  • 应要求,我已添加我的评论作为答案。

标签: azure powershell azure-active-directory azure-powershell


【解决方案1】:

您可以使用Get-AzADApplication 和参数-IdentifierUri 来测试是否已经存在具有该IdentifierUri 的应用:

$appName  = "yourappname123"
$uri      = "http://yourappname123"
$secret   = "yoursecret123"
$password = ConvertTo-SecureString -String $secret -AsPlainText -Force

# test if an app using that uri is already present
$app = (Get-AzADApplication -IdentifierUri $uri)
if ($app) {
    Write-Warning "An app with identifier uri '$uri' already exists: '$($app.DisplayName)'"
    # there already is an app that uses this identifier uri..
    # decide what to do:
    # - choose a new uri for the new app?
    # - change the identifier uri on the existing app?
    #   you can do that using 
    #   $app | Update-AzADApplication -IdentifierUri 'THE NEW URI FOR THIS APP'
}
else {
    # all seems clear; create your new app
    $azureAdApplication = New-AzADApplication -DisplayName $appName -HomePage $Uri -IdentifierUris $Uri -Password $password
}

【讨论】:

    猜你喜欢
    • 2017-09-16
    • 2017-05-24
    • 2015-09-06
    • 1970-01-01
    • 1970-01-01
    • 2021-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多