【问题标题】:What is the AZURE terraform equivalent of this Powershell与此 Powershell 等效的 AZURE terraform 是什么
【发布时间】:2023-03-30 15:09:01
【问题描述】:

我正在尝试将 azure 应用分配给 Azure AD 角色。

在 PowerShell 中我可以做到这一点

## Import-Module AzureAD

## The role to assign to your app
$directoryRole = '[Role Name]' # i.e. 'Administrator'
$AppId = "[Guid]"
    
## Find the ObjectID of Role Name
$RoleId = (Get-AzureADDirectoryRole | Where-Object { $_.displayname -eq $directoryRole }).ObjectId
    
## Add the service principal to the directory role
Add-AzureADDirectoryRoleMember -ObjectId $RoleId -RefObjectId $AppId -Verbose

如何使用 terraform 进行操作?

【问题讨论】:

    标签: azure powershell terraform terraform-provider-azure


    【解决方案1】:

    Terraform 中没有资源可将 AD 角色分配给服务主体。您可以获取有关 AD here 的所有资源。但如果您不介意,可以使用local-exec 在 Terraform 中运行 PowerShell 命令。这将是一种解决方法。

    【讨论】:

      猜你喜欢
      • 2011-01-07
      • 2014-03-12
      • 1970-01-01
      • 2017-01-27
      • 2019-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多