Hi Mark
We understand that you are facing issue with the VPN gateway creating using CLI. The error indicates that the PowerShell script cannot find the specified resource group () in your Azure subscription, resulting in a ResourceGroupNotFound error with a 404-status code.
Here are a few things you can check to troubleshoot the issue:
- Verify Resource Group Name: Double-check the name of your resource group (
<RGNAME>
) that you provided in the script. Ensure that it exactly matches the name of the resource group you created in Azure, including case sensitivity. - Check Subscription Context: Since you're using multiple subscriptions (like your "Connectivity" subscription), make sure you're working in the correct subscription context. Use the following command to check your current subscription and switch if necessary:
If it's incorrect, change the subscription using:Get-AzContext
Set-AzContext -SubscriptionId "<YourSubscriptionID>"
- List Resource Groups: You can list all available resource groups in your current subscription to confirm your resource group exists:
Get-AzResourceGroup
- Ensure Proper Login: Make sure you are logged in to Azure PowerShell correctly. You can use:
to re-authenticate.Connect-AzAccount
- Correct PowerShell Version: Ensure you are using the latest version of Azure PowerShell. You can check your version with:
and update it if necessary.Get-Module -ListAvailable Az
- Check for the Gateway Subnet: Verify that your virtual network has a subnet named
GatewaySubnet
, as this is a requirement for creating a VPN gateway. You can create it if it doesn’t exist.
As you are using policy, review any Azure Policy assignments that might restrict resource group access or VPN gateway creation.
Since you're using an Enterprise-Scale Landing Zone, there might be Azure Policies or Role-Based Access Control (RBAC) restrictions in place.
- Check if there are deny policies on resource creation or specific locations.
- Ensure your user account has Contributor or higher role on the RG.
If the issue persists, consider raising a support ticket with Azure, providing the OperationID from the error message to resolve your issue using backend support.
I hope this helps! If these answers your query, do click the "Upvote" and click "Accept the answer" of which might be beneficial to other community members reading this thread.