-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
az vnet peering create
no longer works cross-tenant
#16691
Comments
network |
I’m trying to repro the problem. If any useful message, we will let you know. |
Please give more detailed steps to reproduce the problem like: |
@jiasli, any insights on this issue? |
Followed the tutorial Create peering - Azure CLI and I am able to reproduce: az login
subA="414af076-009b-4282-9a0a-acf75bcb037e"
subB="0b1f6471-1bf0-4dda-aec3-cb9272f09590"
# Switch to subscription A
az account set -s $subA
# Create resource group A
az group create --name myResourceGroupA --location eastus
# Create virtual network A
az network vnet create --name myVnetA --resource-group myResourceGroupA --location eastus --address-prefix 10.0.0.0/16
# Switch to subscription B
az account set -s $subB
# Create resource group B
az group create --name myResourceGroupB --location eastus
# Create virtual network B
az network vnet create --name myVnetB --resource-group myResourceGroupB --location eastus --address-prefix 10.1.0.0/16
# Switch to subscription A
az account set -s $subA
# Peer myVNetA to myVNetB
az network vnet peering create --name myVnetAToMyVnetB --resource-group myResourceGroupA --vnet-name myVnetA --remote-vnet /subscriptions/$subB/resourceGroups/myResourceGroupB/providers/Microsoft.Network/VirtualNetworks/myVnetB --allow-vnet-access --debug
azure.core.pipeline.policies._universal: Request URL: 'https://management.azure.com/subscriptions/414af076-009b-4282-9a0a-acf75bcb037e/resourceGroups/myResourceGroupA/providers/Microsoft.Network/virtualNetworks/myVnetA/virtualNetworkPeerings/myVnetAToMyVnetB?api-version=2020-07-01'
azure.core.pipeline.policies._universal: Request method: 'PUT'
azure.core.pipeline.policies._universal: Request headers:
azure.core.pipeline.policies._universal: 'Content-Type': 'application/json'
azure.core.pipeline.policies._universal: 'Accept': 'application/json'
azure.core.pipeline.policies._universal: 'Content-Length': '485'
azure.core.pipeline.policies._universal: 'x-ms-client-request-id': '8901a934-6471-11eb-9a33-84a93e63aa78'
azure.core.pipeline.policies._universal: 'CommandName': 'network vnet peering create'
azure.core.pipeline.policies._universal: 'ParameterSetName': '--name --resource-group --vnet-name --remote-vnet --allow-vnet-access --debug'
azure.core.pipeline.policies._universal: 'User-Agent': 'AZURECLI/2.18.0 (MSI) azsdk-python-azure-mgmt-network/17.0.0 Python/3.6.8 (Windows-10-10.0.19041-SP0)'
azure.core.pipeline.policies._universal: 'Authorization': '*****'
azure.core.pipeline.policies._universal: Request body:
azure.core.pipeline.policies._universal: {"id": "/subscriptions/414af076-009b-4282-9a0a-acf75bcb037e/resourceGroups/myResourceGroupA/providers/Microsoft.Network/virtualNetworks/myVnetA", "name": "myVnetAToMyVnetB", "properties": {"allowVirtualNetworkAccess": true, "allowForwardedTraffic": false, "allowGatewayTransit": false, "useRemoteGateways": false, "remoteVirtualNetwork": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/myResourceGroupB/providers/Microsoft.Network/VirtualNetworks/myVnetB"}}} The request header return client.gallery_image_versions.begin_create_or_update(
...
headers={'x-ms-authorization-auxiliary': external_bearer_token}
) We need to synchronize with SDK owner to support |
Workaround with
|
Azure CLI core has supported cross-tenant authentication with Track 2 SDK in #16797. |
Describe the bug
Command Name
az network vnet peering create
Errors:
To Reproduce:
$SECONDARY_TENANT
theNetwork Contributor
role on a Virtual Network ($PRIMARY_VNET_ID
) that lives in$PRIMARY_SUBSCRIPTION
within$PRIMARY_TENANT
.az login -t $PRIMARY_TENANT
az login -t $SECONDARY_TENANT
az network vnet peering create --allow-vnet-access --allow-forwarded-traffic --allow-gateway-transit -n secondary-to-primary --remote-vnet $PRIMARY_VNET_ID -g $SECONDARY_VNET_RG --vnet-name $SECONDARY_VNET_NAME --subscription $SECONDARY_SUBSCRIPTION
Expected Behavior
The VNet peering should be created. This was the case when using v2.12 of the CLI.
Environment Summary
Additional Context
The same also happens when attempting the reverse direction (primary VNet -> secondary VNet peering), with the error output showing the inverse IDs.
We have also developed on v2.17 of the CLI, which produces this same error, and v2.16, which instead produced a
BadRequestError
. Between all four versions (including v2.12 which does not error and successfully creates the peering) the only differences I could see when running with--verbose --debug
were:I tried testing all combinations (old API version & old ordering, new API version & old ordering, etc.) on both v2.12 and v2.17 using the
az rest
command, and got the newLinkedAuthorizationFailed
error in all cases.The text was updated successfully, but these errors were encountered: