Azure / azure-cli

Azure Command-Line Interface
MIT License
3.96k stars 2.94k forks source link

az storage share delete --delete-snapshots include-leased not allowed #21196

Closed pixeye33 closed 1 week ago

pixeye33 commented 2 years ago

Describe the bug When using az storage share delete --name xxx --account-name xxx --account-key xxx --delete-snapshots include-leased we get

ERROR: az storage share delete: 'include-leased' is not a valid value for '--delete-snapshots'. Allowed values: include.

for blob x-ms-delete-snapshots can be {include, only} as seen in Docs blob commands allows it az storage blob delete [--delete-snapshots {include, only}]

for share x-ms-delete-snapshots can be {include, include-leased} as seen in Docs but share commands do not allow include-leased az storage share delete [--delete-snapshots {include}]

Expected behavior being able to use the "include-leased" value. az storage share delete [--delete-snapshots {include, include-leased}]

Environment summary we use the Docker container with version 2.32.0

Additional context this was attempted because when using az storage share delete --name xxx --account-name xxx --account-key xxx --delete-snapshots include we got

Unable to delete share because one or more share snapshots have active leases. Release the share snapshot leases or delete the share with the include-leased parameter for x-ms-delete-snapshots. ErrorCode: DeleteShareWhenSnapshotLeased
<?xml version="1.0" encoding="utf-8"?><Error><Code>DeleteShareWhenSnapshotLeased</Code><Message>Unable to delete share because one or more share snapshots have active leases. Release the share snapshot leases or delete the share with the include-leased parameter for x-ms-delete-snapshots.
RequestId:b5e6aa40-d01a-0027-625a-1709a1000000
Time:2022-02-01T10:57:06.2359390Z</Message></Error>
yonzhan commented 2 years ago

storage

MeCRO-DEV commented 10 months ago

Any updates for this bug? I'm having the same error these days.

MeCRO-DEV commented 10 months ago

I think the rest api has the bug a well.

uri="https://management.azure.com/subscriptions/$sid/resourceGroups/$rg_name/providers/Microsoft.Storage/storageAccounts/$sa_name/fileServices/default/shares/${sName}?api-version=2023-01-01&$include=leased-snapshots"
az rest --method delete --uri "$uri" --verbose

error:

Unable to delete share because one or more share snapshots have active leases. Release the share snapshot leases or delete the share with the include-leased parameter for x-ms-delete-snapshots.

MeCRO-DEV commented 10 months ago

https://learn.microsoft.com/en-us/rest/api/storagerp/file-shares/delete?tabs=HTTP

calvinhzy commented 8 months ago

Hi @pixeye33, opened an issue for the Python SDK, once that is fixed, can support this on the CLI side as well. Thanks.

pixeye33 commented 2 months ago

@calvinhzy issue in azure-sdk-for-python has now been fixed, and hopefully actually is released.

Can you have a look ?