Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idempotency for az network vnet create command #15892

Open
jochenvw opened this issue Nov 12, 2020 · 5 comments
Open

Idempotency for az network vnet create command #15892

jochenvw opened this issue Nov 12, 2020 · 5 comments
Assignees
Labels
feature-request Network az network vnet/lb/nic/dns/etc...
Milestone

Comments

@jochenvw
Copy link

Given the following deployment script:

az network vnet create --resource-group "${prefix}-${project}-${postfix}" --location westeurope --name "${project}-vnet-${postfix}" --address-prefixes 10.0.0.0/16
az network vnet subnet create --resource-group "${prefix}-${project}-${postfix}" --vnet-name ${project}-vnet-${postfix} --name SubnetOne --address-prefixes 10.0.1.0/24 --delegations Microsoft.Web/serverFarms
az network vnet subnet create --resource-group "${prefix}-${project}-${postfix}" --vnet-name ${project}-vnet-${postfix} --name SubnetTwo --address-prefixes 10.0.2.0/24 --delegations Microsoft.Web/serverFarms

This breaks the 2nd time you run it - I suspect because the call to az network vnet create does not provide any subnet information and therefore tries to delete the subnets within the VNET - which it cannot do because of the delegation and VNET integration of some webapp. So therefore, my script is not idempotent.

I notice in my work, that a lot of the people I meet prefer using CLI over ARM templates - influenced by the case made here by Pascal where he states that most commands are idempotent. And that checks out in my experience - all the other stuff I do later in the script - storage accounts, function apps, etc. etc. - works fine. It only errors out on this line.

In case you're interested in making the CLI more idempotent - az network vnet create perhaps needs to be revisited. Making the parameters like --subnet-name into an array is probably hard, because then you would have to accept arrays for all the other parameters as well. So maybe accepting JSON for the subnet configuration or something?

@ghost ghost added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Nov 12, 2020
@yonzhan yonzhan added the Network az network vnet/lb/nic/dns/etc... label Nov 12, 2020
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Nov 12, 2020
@yonzhan yonzhan added this to the S179 milestone Nov 12, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 12, 2020

add to S179

@haroldrandom
Copy link
Contributor

It's a commonly known issue not only for az network vnet create, but also in other commands. We will start an internal discussion about it.

@yonzhan yonzhan modified the milestones: S180, Backlog Dec 7, 2020
@nexxai
Copy link
Contributor

nexxai commented Jun 17, 2021

@haroldrandom What was the result of this? It's kind of important for this command to be idempotent as the current "create" behavior attempts to delete and remake a VNet if it exists, rather than just performing an update like would be expected.

@Dave76
Copy link

Dave76 commented Aug 3, 2021

@haroldrandom any updates on this? Are there any good work arounds? I guess, I have to check for existence before running create?

@jiasli
Copy link
Member

jiasli commented Aug 10, 2021

This issue was previously reported and discussed in #7613.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Network az network vnet/lb/nic/dns/etc...
Projects
None yet
Development

No branches or pull requests

7 participants