fix: pass auxiliary_tenant_ids to ARM client options for cross-tenant authentication#1046
Merged
ms-henglu merged 2 commits intoAzure:mainfrom Feb 3, 2026
Merged
fix: pass auxiliary_tenant_ids to ARM client options for cross-tenant authentication#1046ms-henglu merged 2 commits intoAzure:mainfrom
auxiliary_tenant_ids to ARM client options for cross-tenant authentication#1046ms-henglu merged 2 commits intoAzure:mainfrom
Conversation
magodo
approved these changes
Feb 3, 2026
Contributor
Author
|
test: terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
# Primary tenant/subscription variables
variable "primary_tenant_id" {
type = string
description = "The tenant ID for the primary Azure provider"
default = ""
}
variable "primary_subscription_id" {
type = string
description = "The subscription ID for the primary Azure provider"
default = ""
}
# Cross-tenant variables
variable "cross_tenant_id" {
type = string
description = "The tenant ID for the cross-tenant Azure provider"
default = ""
}
variable "cross_subscription_id" {
type = string
description = "The subscription ID for the cross-tenant Azure provider"
default = ""
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
provider "azapi" {
subscription_id = var.primary_subscription_id
tenant_id = var.primary_tenant_id
}
provider "azapi" {
alias = "cross"
subscription_id = var.cross_subscription_id
tenant_id = var.cross_tenant_id
auxiliary_tenant_ids = [var.primary_tenant_id]
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "networkManager" {
type = "Microsoft.Network/networkManagers@2022-09-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
description = ""
networkManagerScopeAccesses = [
"Routing",
]
networkManagerScopes = {
managementGroups = [
]
subscriptions = [
"/subscriptions/${var.primary_subscription_id}"
]
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "networkManagerConnection" {
provider = azapi.cross
type = "Microsoft.Network/networkManagerConnections@2022-09-01"
parent_id = "/subscriptions/${var.cross_subscription_id}"
name = var.resource_name
body = {
properties = {
networkManagerId = azapi_resource.networkManager.id
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
|
ms-henglu
approved these changes
Feb 3, 2026
matt-FFFFFF
pushed a commit
to matt-FFFFFF/terraform-provider-azapi
that referenced
this pull request
Mar 4, 2026
…nt authentication (Azure#1046) * fix auxiliary_tenant_ids * redact x-ms-authorization-auxiliary in log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #419
Both AdditionallyAllowedTenants and AuxiliaryTenants needs to be set for cross-tenant auth, ref: Azure/azure-sdk-for-go#17159 (comment)