azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

webapp: VNet Integration - Location Check Issue

Open sbhuttan opened this issue 7 years ago • 12 comments

Describe the bug While trying to add VNet-integration to the webapp, getting following error: The app and the vnet resources are in different locations. Cannot integrate a regional VNET to an app in a different region

Both application and VNet are in same region. Region used - "East US 2"

To Reproduce

  1. Use "East US 2" as region for Web app and VNet
  2. Also, VNet and Web App were in separate resource groups. Therefore, resource id of the subnet and VNet was used, instead of just name. /subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/servicepoint-subnet

Expected behavior VNet integration should be added without any errors, as both resources are in same region.

Environment summary CLI Version - 2.0.73 Environment - Visual Studio Code

Additional context I am able to add VNet manually using the portal.

sbhuttan avatar Sep 26 '19 22:09 sbhuttan

@sbhuttan Hello. I will try to reproduce this error.

mmyyrroonn avatar Sep 27 '19 03:09 mmyyrroonn

@sbhuttan It's a webapp command and I will route this issue to them.

mmyyrroonn avatar Sep 27 '19 06:09 mmyyrroonn

@panchagnula Could you please take a look at this issue?

mmyyrroonn avatar Sep 27 '19 06:09 mmyyrroonn

@sbhuttan the command support only the latest VNET integration feature - Regional VNET & not classic or V2VNET - this message

'the app and the vnet resources are in different locations. Cannot integrate a regional VNET to an app in a different region'

are on different regions & this need to be the same region - that's by design. if are trying to use the classic or point to site please use portal, for RegionalVNET - the VNET & APP resources should be created on the same region/location.

panchagnula avatar Sep 30 '19 22:09 panchagnula

if they are in the same region can you share the name of the app & VNET? thank you.

panchagnula avatar Oct 01 '19 00:10 panchagnula

I have the same problem. I have tested with version 2.0.76 on Mac OS Catalina.

Steps to reproduce: az group create -n olavs-test-rg -l westeurope az appservice plan create -g olavs-test-rg -n olavs-plan -l westeurope --sku S1 az webapp create -g olavs-test-rg -p olavs-plan -n olavs-app az network vnet create -g olavs-test-rg -n olavs-vnet --address-prefixes 10.0.0.0/8 az network vnet subnet create -g olavs-test-rg --vnet-name olavs-vnet -n olavs-subnet --address-prefixes 10.0.0.0/16 az webapp vnet-integration add -g olavs-test-rg -n olavs-app --vnet olavs-net --subnet olavs-subnet

The last command results in the error message: The app and the vnet resources are in different locations. Cannot integrate a regional VNET to an app in a different region

If I then go to the portal and looks up the olav-app webapp I have just created and go to "Networking" and the click the "Add VNet (preview)" it works just fine and I can link the same VNet/Subnet that Azure CLI can't add.

I note that the webapp gets location "West Europe" even if I have specified the location on the service plan to be "westeurope". The VNet gets location "westeurope" even if I add a parameter -l "West Europe" on the create statement. Could this be the bug? I.e. that the vnet-integration add compares "West Europe" and "westeurope" and finds them to be different even if they are supposed to be the same?

onybo avatar Nov 14 '19 13:11 onybo

it seems that the error message may be very misleading. Using a non-existing vnet name gives the same error message: az webapp vnet-integration add -g olavs-test-rg -n olavs-app --vnet this-vnet-does-not-exist --subnet olavs-subnet

Gives the following output:

This command group is in preview. It may be changed/removed in a future release.
The app and the vnet resources are in different locations.                         Cannot integrate a regional VNET to an app in a different region

There is no vnet named this-vnet-does-not-exist in my subscription

onybo avatar Nov 15 '19 11:11 onybo

Thanks we will update our validation message.

panchagnula avatar Dec 27 '19 00:12 panchagnula

Am getting the same message when trying to add a VNet in SubscriptionA to a function app in SubscriptionB. Really need that to be allowed, but it seems like it's not. However, the error message is misleading since both the VNet and function app are in West Europe.

joedyndale avatar Feb 21 '20 12:02 joedyndale

I had the same problem. I ended up adding the VNET integration when creating the appservice with an ARM-template. This template worked for me:

https://github.com/ScottHolden/ARMExamples/blob/master/AppService-VnetNew-Storage/deploy.json

srieppo2 avatar Mar 06 '20 11:03 srieppo2

looking in to it.

Kotasudhakarreddy avatar Apr 13 '20 08:04 Kotasudhakarreddy

Thanks to figure out that not existing vnet can show above error.

I figured out also that vnet name is case sensitive!

Some more details about this issue and solution:

  1. I created appservice plan, web app over portal with above issue
  2. location for RG/VNET = eastuse2, location for app plan and web app EAST US 2
  3. Not able integrate web/vnet, dropdownbox shows all vnet but there were not split between region and gataway vnet.

Solution:

  1. use azure cli commands to create app plan, web and --location eassus2
  2. integration to vnet was possible this time over portal-> Able to see list of VNET's "same region" over cli az webapp vnet-integration add -g test-dev -n test-dev --vnet VPN_TEST_DEV --subnet app --debug Note: CASE SENSITIVE name of VNET !!!

mmatonok avatar May 21 '20 15:05 mmatonok