Azure / Enterprise-Scale

The Azure Landing Zones (Enterprise-Scale) architecture provides prescriptive guidance coupled with Azure best practices, and it follows design principles across the critical design areas for organizations to define their Azure architecture
https://aka.ms/alz
MIT License
1.69k stars 963 forks source link

Fix subscriptionIds for no network deployment scenario #1574

Closed arjenhuitema closed 7 months ago

arjenhuitema commented 7 months ago

Overview/Summary

Fixes an issue where the deployment of the UAMI Resource Group fails with the following error:

{"code":"InvalidTemplateDeployment","message":"The template deployment failed with error: 'Authorization failed for template resource 'rg-ama-prod-001' of type 'Microsoft.Resources/resourceGroups'. The client '-----' with object id '-----' does not have permission to perform action 'Microsoft.Resources/subscriptions/rg-ama-prod-001/write' at scope '/subscriptions//resourceGroups/rg-ama-prod-001'.'."}

When networking is not deployed the connectivitySubscriptionId remains empty and it is included as empty in the subscriptionIdsvariable.

This PR fixes/adds/changes/removes

  1. Adds an if statement checking whether the paramater connectivitySubscriptionId is empty. Based on the outcome, it now either creates an array of managementSubscriptionId and identitySubscriptionId, or the previous 2 and connectivitySubscriptionId.

Breaking Changes

None

Testing Evidence

Deployment

image

Deploying with no networking now skips creating RG and UAMI for the connectivity subscription.

image

Testing URLs

Azure Public

Deploy To Azure

As part of this Pull Request I have