gpt4 book ai didi

azure - 如何从 terraform 获取 Azure Security Insights 对象 ID?

转载 作者:行者123 更新时间:2023-12-03 06:16:09 25 4
gpt4 key购买 nike

我需要在 Azure Security Insights 应用程序上添加 Azure Sentinel Automation Contributor 角色。为此,如何通过 terraform 获取 Azure Active Directory 中的企业应用程序中存在的 Azure Security Insights 应用程序的 objectId?

resource "azurerm_role_assignment" "sentinel_contributor" {
scope = "/subscriptions/<subId>/resourceGroups/<rg>"
// role_definition_id = azurerm_role_definition.sentinelcontributor.id
role_definition_name = "Azure Sentinel Contributor"
principal_id = "3367a746-xxx18686"#objectid of azure security insights app

}

最佳答案

要通过 terraform 获取 Azure Active Directory 企业应用程序中存在的 Azure Security Insights 应用程序的 objectId,您可以使用以下代码:

data "azuread_service_principal" "security_insights_app" {
display_name = "Azure Security Insights"
}

output "security_insights_app_object_id" {
value = data.azuread_service_principal.security_insights_app.object_id
}

我的租户的企业应用程序中有 Azure Security Insights 应用程序,如下所示:

enter image description here

当我运行下面的 terraform 代码时,我成功获得了 Azure Security Insights 应用程序的 ObjectID 响应,如下所示:

data "azuread_service_principal" "security_insights_app" {
display_name = "Azure Security Insights"
}

output "security_insights_app_object_id" {
value = data.azuread_service_principal.security_insights_app.object_id
}

回应:

enter image description here

关于azure - 如何从 terraform 获取 Azure Security Insights 对象 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76236611/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com