user3702188
user3702188

Reputation: 69

Creating azure application gateway with azure cli

anyone know if it is possible to create app gw with azure cli, when my vnet is in different resource group, not in the same as i'm creating the application gateway in? It seems az command doesnt let me provide --vnet-name id of vnet. If i provide the name of it, it just created new on in same resource group where i'm creating the app gateway.

Is it possible to reference the vnet from another resource group when using command - az network application-gateway create? As it seems from parameters only subnet supports the reference by ID... Is there a workaround?

--subnet Name or ID of the subnet. Will create resource if it does not exist. If name specified, also specify --vnet-name.

--vnet-name The virtual network (VNet) name.

Upvotes: 0

Views: 678

Answers (2)

Charles Xu
Charles Xu

Reputation: 31414

Yeah. In Azure, there are many resources and sub-resources. Most have the ID that represents the unique one in Azure. For Subnet, it belongs to Vnet. If it exists and the ID can only refer to it.

So if you want to reference the existing subnet of a Vnet in Azure you just need to reference its ID. In addition, the Application Gateway needs an empty subnet and there should be no resource in it. You should pay attention to this point.

Upvotes: 2

user3702188
user3702188

Reputation: 69

Got this answered by @Charles Xu.

The subnet always in a Vnet. If you reference the subnet it also means reference the Vnet. – Charles Xu

Upvotes: 0

Related Questions