- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 2 个 Azure 租户:
租户A用于存储存储库和管道
tenantB用于部署基础设施,terraform(后端)状态文件也存储在这里
因此,我从租户 A 获取存储库,使用 az login
连接到租户 B 并运行 terraform 命令。现在我想在租户A 中使用Azure 管道来自动化此过程。我在租户 A 中创建了连接到租户 B 的服务主体。验证成功,az login --service-principal -u "spn_id"-p "spn_secret"--tenant "tenantB_id"
也有效。但是,当我从tenantA运行管道时,或者当我使用az login
登录到tenantA并运行terraform时,我收到错误:
错误:构建 ARM 配置时出错:从 Azure CLI 获取订阅(id):从 Azure CI 解析 json 结果:WAITING Azure CLI:退出状态 1:错误:找不到订阅“id”。检查拼写并重试。
我的 TF 代码:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
}
backend "azurerm" {
tenant_id = tenantB_id
subscription_id = tenantB_subscription_id
resource_group_name = resource_group_name
storage_account_name = storage_account_name
container_name = container_name
key = key_name
}
}
}
provider "azurerm" {
features {}
client_id = tenantA_service_principal_id
client_secret = tenantA_service_principal_secret
tenant_id = tenantB_id
subscription_id = tenantB_subscription_id
}
请注意,在tenantA中我没有订阅,只能使用az login --allow-no-subscriptions
登录。
最佳答案
检查以下内容:
您需要进行az登录
使用凭据登录并
为租户B设置订阅
az account set --subscription <desiredSubscriptionId>
您可以向 az login --allow-no-subscriptions
授予租户级别访问权限。
由于您使用服务主体向租户 B 进行身份验证,因此请确保服务主体在租户 B 中具有访问订阅所需的权限。为服务主体分配“贡献者”角色或更高级别的tenantB 订阅。
另外检查 Terraform 代码中的订阅 ID 是否正确。
如果没有正确提供订阅,您将面临订阅错误。
Status=404 Code="SubscriptionNotFound" Message="The subscription 'fx0' could not be found."xx
如果租户错误,您可能会遇到如下错误:构建 ARM 配置时出错:请确保您已安装 Azure CLI 版本
在这种情况下,运行以下命令来设置正确的租户,其中授予贡献者等适当的权限。
az login --tenant TENANT_ID
使用 terraform 的 Assin 贡献者角色。
resource "azurerm_role_assignment" "example" {
scope = "/subscriptions/${var.tenantB_subscription_id}"
role_definition_id = "/subscriptions/${var.tenantB_subscription_id}/providers/Microsoft.Authorization/roleDefinitions/${var.role_definition_id}" or // azurerm_role_definition.Contributor.id
principal_id = var.tenantA_service_principal_id
}
或者您可以通过 Azure cli 来完成
az role assignment create --assignee-object-id <ServiceprincipleObjectId> --assignee-principal-type ServicePrincipal --role Reader --scope /subscriptions/subscrptionIdoFtenantB/resourceGroups/MyResourceGroup --name <Idofrole>
然后尝试运行 terraform init
> terraform plan
或 terraform apply
关于azure - 在 azure pipeline 中运行 terraform 以部署到另一个租户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76045971/
2 个不同的租户(租户 A 中的订阅 A 和租户 B 中的订阅 B) 我们在 Azure 云中有一个订阅,并且我们已经设置了 Azure Keyvault。我们可以在那里创建 key 并使用其中一个
如何在代码中配置 Windows Azure Active Directory 租户? 我希望能够允许用户访问我的 Multi-Tenancy SaaS 应用程序、注册我的服务并为其配置 Azure
我阅读了有关 headless 应用程序如何通过 Azure 进行身份验证的各种文章。我对术语有点困惑。在此sample code ,它说它需要一个 Azure AD 租户帐户。 我的理解是Azure
背景:我正在使用 Django 开发我的第一个 Multi-Tenancy 应用程序。我已经成功按照 https://github.com/tomturner/django-tenants 给出的教程
我正在尝试让 Microsoft 验证我的应用。第一步是成为微软合作伙伴,但我不知道如何登录? 当我尝试创建 Azure AD 租户时,我被告知我没有权限(即使我拥有该帐户)。 我无法使用用于登录 A
我开始学习 Microsoft Azure,但我陷入困境谁能详细告诉我 Microsoft 帐户、租户和订阅之间有什么区别? 最佳答案 当您说“Microsoft 帐户”时,这通常指个人 Micros
摘要:如何动态获取Microsoft用户的Tenant ID? 详细信息:我正在编写一个 Multi-Tenancy 应用程序(C# 和 .NET Core),我想使用它来创建订阅和 register
我正在尝试在澳大利亚区域创建 Azure B2C 租户,但在区域下拉列表中找不到澳大利亚。文档显示 Azure B2C 租户在所有位置都可用。我错过了什么吗? 最佳答案 基于Data residenc
我正在尝试在澳大利亚区域创建 Azure B2C 租户,但在区域下拉列表中找不到澳大利亚。文档显示 Azure B2C 租户在所有位置都可用。我错过了什么吗? 最佳答案 基于Data residenc
我正在尝试 ad-b2c,天哪,即使第一步结果也非常令人沮丧。无论如何,这是我的问题: 我的现有订阅有一个默认目录,该目录有自己的 mydefaultdirectory.onmicrosoft.com
我正在开发一个 ASP.NET MVC 应用程序,它必须访问 Office365 API。我使用了描述here为了获得仅应用程序的访问 token 。 现在,运行应用程序后,我进入 AAD 同意流程以
假设我购买了位于 Azure AD 租户 1(与资源林同义)中的 Multi-Tenancy 应用程序(HR 软件)。 我还购买了 Azure 租户 2 中另一家公司拥有的健康应用程序。 我不拥有租户
这是我的场景:新用户使用 Azure B2C 工作流程注册我们的 Web 应用程序。用户可以使用不同的身份提供商(Google、Microsoft、Amazon)进行注册。用户需要访问数据库。我想将他
我正在尝试删除我的 Azure AD 租户,但它显示: Directory has one or more applications. 我按照此处的步骤操作 https://support.micro
我有两个 B2C 租户。一种用于生产环境,另一种用于临时环境。我想将所有用户从生产租户迁移到暂存租户。我想定期这样做,用真实数据对临时环境进行测试。我知道我可以读取一个租户的所有用户并将其写入另一个租
Microsoft 的 UI 显示所有初始检查均已通过,他们可以删除此 Azure Active Directory 租户。随后出现消息称 Microsoft 实际上无法删除租户。我还能做些什么来真正
我正在尝试删除我的 Azure AD 租户,但它显示: Directory has one or more applications. 我按照此处的步骤操作 https://support.micro
我有两个 B2C 租户。一种用于生产环境,另一种用于临时环境。我想将所有用户从生产租户迁移到暂存租户。我想定期这样做,用真实数据对临时环境进行测试。我知道我可以读取一个租户的所有用户并将其写入另一个租
Microsoft 的 UI 显示所有初始检查均已通过,他们可以删除此 Azure Active Directory 租户。随后出现消息称 Microsoft 实际上无法删除租户。我还能做些什么来真正
有没有办法阻止用户登录到他们自己的 AAD 租户?例如,允许登录 contoso.onmicrosoft.com 但不允许登录 fabrikam.onmicrosoft.com。 我的客户有一个高度受
我是一名优秀的程序员,十分优秀!