简体   繁体   English

我怎样才能 terraform 授予访问我的 Azure Active Directory 租户

[英]How can I terraform granting access to my Azure Active Directory Tenant

Input: client_id , subscription_id , resource-group-name , .输入: client_idsubscription_idresource-group-name 、 。

Manual / command line steps:手动/命令行步骤:

  1. Approving at批准于
https://login.microsoftonline.com/<tenant-id>/oauth2/authorize?client_id=<client_id>&response_type=code
  1. Creating a new role ( az role definition create --output none --role-definition )创建新角色( az role definition create --output none --role-definition
  2. Creating a role assignment ( az role assignment create ).创建角色分配 ( az role assignment create )。

Steps 2-3 are pretty easy since I could leverage azurerm TF Provider and, more speficially, its azurerm_role_definition and azurerm_role_assignment resources but I'm kinda confused about step #1.第 2-3 步非常简单,因为我可以利用azurerm TF Provider,更具体地说,它的azurerm_role_definitionazurerm_role_assignment 资源,但我对第 1 步有点困惑。

Update: after googling it seems like step #1 is very similar to Enable Azure Active Directory in your App Service app if that helps.更新:谷歌搜索后,步骤 #1 似乎与在您的 App Service 应用程序中启用 Azure Active Directory非常相似(如果有帮助的话)。

Before you can even get Terraform to interact with Azure/Azure AD resources you need to get Terraform to authenticate to it.在获得 Terraform 与 Azure/Azure AD 资源交互之前,您需要获得 Terraform 以对其进行身份验证。

If you're running your Terraform code locally, the process is generally to authenticate using the Azure CLI - az login and then you provide the code shown by the CLI, to the authentication page.如果您在本地运行 Terraform 代码,该过程通常是使用 Azure CLI - az login进行身份验证,然后您将 CLI 显示的代码提供给身份验证页面。

If you want to do this non-interactively, the best practice is you'd need to get the Terraform code run on a machine that either has Managed Identities enabled.如果您想以非交互方式执行此操作,最佳做法是您需要在启用了托管身份的计算机上运行 Terraform 代码。 Either a System-Assigned or a User-Assigned identity.系统分配或用户分配的标识。

Another possible but less direct approach would be to use a Service Principal with a Client Secret for Terraform to authenticate .另一种可能但不太直接的方法是使用服务主体和Terraform 的客户端机密来进行身份验证 this is kinda like the link you provided for the App Service.这有点像您为应用服务提供的链接。

Try to follow the steps in those two links above as these are from Terraform and have all required steps to ensure you are able to set it up right.尝试按照上面这两个链接中的步骤进行操作,因为这些链接来自 Terraform 并且具有所有必需的步骤以确保您能够正确设置它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Terraform 授予对 GCP Bigquery 的访问权限 - Terraform granting access on GCP Bigquery 如何访问我的活动通知数据? - How can I access my active notifications data? 我无法授予我的 web 应用访问 Azure App Service Environment V3 上的 Azure Key Vault - I couldn't granting my web app access to Azure Key Vault on Azure App Service Environment V3 如何将 Terraform 中的逻辑用于 Azure? - How can i use logic in Terraform for Azure? 我如何在 azure 活动目录上创建用户的密码配置文件时调整它 - how can i adjust the password profile of a user while iam creating it on azure active directory 为什么我在通过 Azure AD App-Only 授予访问权限时收到 401 Unauthorized? - Why do I get 401 Unauthorized when granting access via Azure AD App-Only? 如何使用 Active Directory 身份验证从 Tableau Desktop 访问 Azure SQL 服务器/数据库 - How to Access Azure SQL Server/Database from Tableau Desktop using Active Directory Authentication Azure Active Directory:如何检查设备成员资格? - Azure Active Directory: How to check device membership? 如何在 Azure 活动目录中设置 session cookie? - How to setup session cookie in Azure Active directory? Azure 活动目录 MFA - Azure Active Directory MFA
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM