我正在尝试修改我的应用程序标识符 URI 的格式:
将“https://app-contoso.api-qa.contoso.onmicrosoft.com
”转换为“api://(app id)
”格式
我正在使用 Terraform 来执行此操作。
所以如果我只是使用:
application_identifier_uris = [format("api://%s", random_uuid.contoso-api-app.result)]
我得到一个随机 ID,而不是实际的应用 ID。 如何确保获得“api://(app ID)”格式的实际应用程序 ID 我必须使用随机 uuid,因为如果我引用应用程序模块中应用程序 ID 的输出,我会在 Terraform 中出现循环错误。
我正在使用我们自己的应用程序模块来进行应用程序注册
最佳答案
i get a random id and not the actual app ID. How do i ensure that i get the actual App ID in the format "api://(app ID)" I have to use a random uuid as i get a cyclic error in Terraform if i refer the output of the app ID from my application module.
您正在生成一个随机 GUID 并在那里分配值,因此您将获得随机 ID,而不是实际的应用 ID。至于循环错误,如果您使用对 AppID 的引用,您将收到如下图所示的错误,因为应用程序在您引用它的同时被创建,因此在创建后仅会显示应用程序 ID可用或已识别。
因此,上述内容目前在 terraform 中是不可能的,因为您已经知道在这个 Github Issue 中已经提出了一个功能标志或增强。 .
<小时/>对于解决方案,您可以使用其他管理工具,例如 Powershell/Azure-CLI
更新identifier uri's
.
从 terraform 创建 Azure AD 应用程序后,您可以使用 AzureAD模块或 az ad app CLI 模块以编程方式更新应用程序。
对于您的用例,Powershell 脚本将如下所示:
Connect-AzureAD
$app= Get-AzureADApplication -Filter "DisplayName eq 'ansumanterraformtest'"
$appobjectid = $app.ObjectId
$appId = $app.AppId
Set-AzureADApplication -ObjectId $app.ObjectId -IdentifierUris "api://$appId"
输出:
关于azure - 使用 Terraform 时,Azure AD 应用程序注册中的应用程序 ID URI 出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70193492/