Azure regions

binod ranabhat 1 Reputation point
2023-09-04T06:00:26.0866667+00:00

Hi,

Using Bicep template to deploy virtual machine in my subscription.

Trying to deploy in Resource Group1 lets say, but the vnet is in resource Group2.

They both are in same regions.

But using the Azure bicep template I want to use existing vnet and subnet to provision vm there, but keeps throwing error,

Please make sure that the referenced resource exists, and that both resources are in the same region

Any IDEA ?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,787 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. K Sheahan Kularathne 431 Reputation points
    2023-09-04T15:46:12.7133333+00:00

    You can create a VM using Vnet with a deferent RG. You can test this using the below template.

    https://github.com/azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.compute/vm-different-rg-vnet

    If above is working, then it has to do something with the bicep code. You can review the json file to get an idea.

    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.