Open v-manish opened 3 years ago
storage
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.
Author: | v-manish |
---|---|
Assignees: | Juliehzl |
Labels: | `OKR3.2 Candidate`, `Service Attention`, `Storage`, `feature-request` |
Milestone: | S182 |
Hi @v-manish, thanks for your feedback. You are right. CLI have to make sure there is SDK supported first.
When we are trying to enable the lifecycle management from the Azure portal, it is working for all the three subtypes base blobs, snapshots and versions, below is the screenshot:
Below is the code view for the same: { "rules": [ { "enabled": true, "name": "apsartest", "type": "Lifecycle", "definition": { "actions": { "version": { "delete": { "daysAfterCreationGreaterThan": 30 } }, "baseBlob": { "delete": { "daysAfterModificationGreaterThan": 90 } }, "snapshot": { "delete": { "daysAfterCreationGreaterThan": 60 } } }, "filters": { "blobTypes": [ "blockBlob" ] } } } ] }
But when we try to update or create policy using CLI command , the version (Blob Subtype) is getting ignored ( i.e. LCM policy is getting created without Versions)
az storage account management-policy create --account-name 'apsareastus' --policy "policy.json" --resource-group 'mycommanresourcegroup'
It seems the root cause is that there is no API exposed in SDK to CLI. As you can see in swagger, there is no version action defined in latest api version.
https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/Microsoft.Storage/preview/2020-08-01-preview/storage.json#L3721-L3733
https://docs.microsoft.com/en-us/rest/api/storagerp/managementpolicies/createorupdate#managementpolicyschema
In the above REST API document, the version is defined at the top of the page as below:
But in the swagger definition, which is used to generate SDK for all languages, there is no definition for version in rule as you can see in https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/Microsoft.Storage/stable/2019-06-01/storage.json#L3334-L3344.
could you please provide an update or any work around how to use version parameter.
Thank you in advance.
Describe the bug
To Reproduce
Expected behavior
Environment summary
Additional context