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

Support delete option for NICs and Disks for VMs in Azure CLI #17846

Closed
szimmer-dev opened this issue Apr 23, 2021 · 7 comments · Fixed by #18238
Closed

Support delete option for NICs and Disks for VMs in Azure CLI #17846

szimmer-dev opened this issue Apr 23, 2021 · 7 comments · Fixed by #18238
Assignees
Milestone

Comments

@szimmer-dev
Copy link

Resource Provider
CRP

Description of Feature or Work Requested
User experience:

image

In text:

az vm create
-n MyVm
-g MyResourceGroup
--public-ip-address-dns-name MyUniqueDnsName
--image ubuntults
--size Standard_DS2_v2
--generate-ssh-keys
--data-disk-sizes-gb 10 20
--data-disk-delete-option 0=Detach 1=Delete /*Use a singular value to apply on all data disks, or use = to configure the delete behavior for individual disks
--os-disk-delete-option Delete
--nic-delete-option = /*Use a singular value to apply on all nics, or use = to configure the delete behavior for individual NICs

The new switches do the following
--nic-delete-behavior configures the deleteOption field for the NIC created for the VM
vm.properties.networkProfile.networkInterfaces[0].properties.deleteOption = "Delete"

--os-disk-delete-option Delete configures delete option for the OS Disk
cstorageProfile.dataDisks[*].osDisk= "Delete"

--data-disk-delete-option configures the delete option for data disks as specified
vm.properties.storageProfile.dataDisks[*].deleteOption = "Delete"

Swagger PR containing the deleteOption for VM NICs: Azure/azure-rest-api-specs#13449

Swagger PR for disk deleteOption: Azure/azure-rest-api-specs#13657

Minimum API Version Required
2021-03-01

Swagger Link

Target Date
5/25

@ghost ghost added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Apr 23, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Apr 25, 2021
@yungezz
Copy link
Member

yungezz commented Apr 25, 2021

hi @szimmerMicrosoft there's no concrete ETA on when 2021-03-01 Swagger will be avaiable, there's high risk to catch 5/25 timeline. Based on info I got from Adam, Swagger will be ready for review at week of 4/26. With it, I dont' think features in 2021-03-01 could catch 5/25 release.

cc @qwordy.

@yonzhan yonzhan added this to the S188 milestone May 13, 2021
@Juliehzl
Copy link
Contributor

Hi @szimmerMicrosoft, it is only supported for vm create not including vmss create, right?

@szimmer-dev
Copy link
Author

disk deleteOption is currently only supported for vm, not for VMSS.

We do have the ability to configure it for VMSS on NICs. We could support that now, or we could wait for deleteOption support for both disks and NICs to be possible on VMSS.

Setting deleteOption on VMSS flex for NICs is probably a small minority choice so not a hard requirement now.

@Juliehzl
Copy link
Contributor

Juliehzl commented May 26, 2021

Hi @szimmerMicrosoft One more thing to clarify is that for key=value format, the key is name or resource ID to use? Currently my design is if name is used for --nics, delete option has to be name=Delete. If resource id is used, then delete option will be ID=xxx. If you have any other suggestions, feel free to let me know.

@szimmer-dev
Copy link
Author

szimmer-dev commented May 26, 2021

The only option for NICs parameter looking here

nics_id = '{}/networkInterfaces/{}'.format(network_id_template, nic_name)

Appears to be resourceIds.

vmName is used as the singular NIC name if nic_type == new.

Using the name as resourceId if the user provides resource id makes sense.

If the NIC being created is implicit I don't see any value in letting the user specify the VM name for the deleteOption, there is only one NIC, so let it just be deleteOption = X

Let me know if I am misunderstanding how the create command works.

@Juliehzl
Copy link
Contributor

The only option for NICs parameter looking here

nics_id = '{}/networkInterfaces/{}'.format(network_id_template, nic_name)

Appears to be resourceIds.

vmName is used as the singular NIC name if nic_type == new.

Using the name as resourceId if the user provides resource id makes sense.

If the NIC being created is implicit I don't see any value in letting the user specify the VM name for the deleteOption, there is only one NIC, so let it just be deleteOption = X

Let me know if I am misunderstanding how the create command works.

We also could use existing nics and set deleteOption for them. Both name and resource id format are allowed for existing nics. If users provide name, we will format it to resource id:
https://github.com/Azure/azure-cli/blob/bc8fca8df0b9087e44381def0afc8fee7768083e/src/azure-cli/azure/cli/command_modules/vm/_validators.py#L960-L964

@szimmer-dev
Copy link
Author

Oh great,so identifying those via name makes sense.

However the user specifies the NICs, using that as the key I think is sensible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants