簡體   English   中英

如何在Azure Active Directory應用程序中使用PowerShell刪除identifierUris

[英]How to remove identifierUris using PowerShell in Azure Active Directory Application

我正在關注本文https://blogs.msdn.microsoft.com/azuresqldbsupport/2017/09/01/how-to-create-an-azure-ad-application-in-powershell/以使用以下方法創建Azure Active Directory Application PowerShell但失敗,因為identifierUris已經存在。

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

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

創建應用程序之前是否可以刪除標識符,或者在創建應用程序之前進行驗證檢查是否存在identifierUri

您可以使用帶有參數-IdentifierUri Get-AzADApplication來測試是否已存在具有該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
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM