Description
Describe the bug
Command Name
az network vnet peering create
Errors:
ForbiddenError: (LinkedAuthorizationFailed) The client has permission to perform action 'Microsoft.Network/virtualNetworks/peer/action' on scope '/subscriptions/$SECONDARY_SUBSCRIPTION/resourceGroups/mzink-test/providers/Microsoft.Network/virtualNetworks/mzink-test-vnet/virtualNetworkPeerings/mzink-test-vnet-to-mzink-vnet', however the current tenant '$SECONDARY_TENANT' is not authorized to access linked subscription '$PRIMARY_SUBSCRIPTION'.
To Reproduce:
- Give a user in
$SECONDARY_TENANT
theNetwork Contributor
role on a Virtual Network ($PRIMARY_VNET_ID
) that lives in$PRIMARY_SUBSCRIPTION
within$PRIMARY_TENANT
. - Log in to both tenants as the user from the secondary 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
Linux-5.4.0-58-generic-x86_64-with-debian-buster-sid
Python 3.6.10
Installer: DEB
azure-cli 2.18.0
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:
- the ordering of the JSON body fields
- the API version (2020-06-01 for v2.12, then 2020-07-01 for v2.16+)
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 new LinkedAuthorizationFailed
error in all cases.