Azure / missionlz

Azure landing zone for SCCA-compliant organizations.
MIT License
214 stars 122 forks source link

AVD Addon: Can't find resource #1025

Closed RTPhillips closed 1 month ago

RTPhillips commented 1 month ago

Description

Didn't use this specific MLZ repo for actual LZ, but when running AVD LZ Addon run into resource missing error.

Have Test Sub where AVD will be deployed, and Prod Sub with Hub network. When deployment reaches the peering configuration of the control plane, receive the following error: { "status": "Failed", "error": { "code": "InvalidGlobalResourceReference", "message": "Resource /subscriptions/{Test Sub ID}/resourceGroups/{Prod RG ID}/providers/Microsoft.Network/virtualNetworks/{Prod VNet} referenced by resource /subscriptions/{Test Sub ID}/resourceGroups/avd-0-rg-network-avd-test-va/providers/Microsoft.Network/virtualNetworks/avd-0-vnet-avd-test-va/virtualNetworkPeerings/{Prod VNet} was not found. Please make sure that the referenced resource exists.", "details": [] } }

Additional context

Verified all sub/RG/Vnets were in the same region.

Project Details Subscription set to Test Sub Hub Resources Subscription set to Prod Sub

Azure Government

RTPhillips commented 1 month ago

I think I found the issue, line 1930 is setting the scope of the deployment (of the peering) to the spoke sub, in my case Test. Line 1980 not specifying the subid had it defaulting to the scope. I hardcoded that id to the hub Vnet resource id and that part of the deployment went through.

I used the resource id of a failed partial deployment for the spoke side of the peering but I think it had the same issue line 1995 where the scope is set to the Hub sub, and line 2045 where the subscription isn't set.

After I get this deployed so my customer can poke around at it I can run through another deployment and try out adding the subscription as part of line 1980 and 2045 to see if that resolves the issue. Not sure if that would then break with a typical MLZ deployment, but I wouldn't think so.

jamasten commented 1 month ago

Thanks for the info @RTPhillips. I'll check out those sections and get a fix in ASAP.

jamasten commented 1 month ago

@RTPhillips I added a fix to the AVD Add-On that should fix your issue. Please test and let me know if you're still experiencing the issue.