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

"az snapshot grant-access" fails with "Accessing disk or snapshot with a logical sector size of 4096 requires specifying the file format. Set the fileFormat property to VHDX." #28320

Closed
riccom76 opened this issue Feb 7, 2024 · 4 comments · Fixed by #28583
Assignees
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved. Compute az vm/vmss/image/disk/snapshot
Milestone

Comments

@riccom76
Copy link

riccom76 commented Feb 7, 2024

Describe the bug

CLI cmdlet "az snapshot grant-access", using APIs equal or later than 2023-01-02, fails with "Accessing disk or snapshot with a logical sector size of 4096 requires specifying the file format. Set the fileFormat property to VHDX".

[ ~ ]$ az snapshot grant-access --duration-in-seconds 3600 --resource-group martinme_repro --name premV2Snap

(BadRequest) Accessing disk or snapshot with a logical sector size of 4096 requires specifying the file format. Set the fileFormat property to VHDX.
Code: BadRequest
Message: Accessing disk or snapshot with a logical sector size of 4096 requires specifying the file format. Set the fileFormat property to VHDX.

When trying to pass the "fileFormat" as parameter for CMDLets, an error is returned saying the 'fileFormat' isn't valid.

[ ~ ]$ az snapshot grant-access --duration-in-seconds 3600 --resource-group martinme_repro --name premV2Snap --fileFormat VHDX unrecognized arguments: --fileFormat VHDX

Tested with RESTAPI --> Snapshots - Grant Access - REST API (Azure Compute) | Microsoft Learn
The supported api-versions are '2016-04-30-preview, 2017-03-30, 2018-04-01, 2018-06-01, 2018-09-30, 2019-03-01, 2019-07-01, 2019-11-01, 2020-05-01, 2020-06-30, 2020-09-30, 2020-12-01, 2021-04-01, 2021-08-01, 2021-12-01, 2022-03-02, 2022-07-02, 2023-01-02, 2023-04-02, 2023-10-02'

"az snapshot grant-access", using APIs equal or later than 2023-01-02, do not offer any parameter to define the "fileFormat".

RestAPI Snapshots - Grant Access - REST API (Azure Compute) | Microsoft Learn accepts the "fileFormat" as parameter. CLI cmdlet should do the same.

Related command

az snapshot grant-access --duration-in-seconds 3600 --resource-group martinme_repro --name premV2Snap

Errors

[ ~ ]$ az snapshot grant-access --duration-in-seconds 3600 --resource-group martinme_repro --name premV2Snap --fileFormat VHDX
unrecognized arguments: --fileFormat VHDX

Issue script & Debug output

Expected behavior

"az snapshot grant-access", using APIs equal or later than 2023-01-02, do not offer any parameter to define the "fileFormat".

RestAPI Snapshots - Grant Access - REST API (Azure Compute) | Microsoft Learn accepts the "fileFormat" as parameter. CLI cmdlet should do the same.

Environment Summary

Azure Portal CloudShell

Additional context

No response

@riccom76 riccom76 added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Feb 7, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Compute az vm/vmss/image/disk/snapshot label Feb 7, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team labels Feb 7, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Feb 7, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Feb 7, 2024
@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Feb 7, 2024
@yonzhan yonzhan added this to the Backlog milestone Feb 7, 2024
@yanzhudd
Copy link
Contributor

Hi @riccom76,
currently CLI has no parameter to set the field "fileFormat". If you want CLI to support this feature, please provide the necessary info by raising a feature request using this feature request template.

@riccom76
Copy link
Author

hi @yanzhudd , this is not a feature request but more a fix to a misalignment between the CLI cmdlet parameters and what the RestAPI version used is expecting as parameters when invoked.

RestAPI Snapshots - Grant Access - REST API (Azure Compute) | Microsoft Learn vesion equal or later than 2023-01-02, expects the "fileFormat" to be there. This CLI cmdlet has to be updated to accommodate what the RestAPI expects as passed parameters.

@yanzhudd
Copy link
Contributor

Hi @riccom76
I have raised a PR to fix this issue, could you please help to verify if this private package meets your expectation?
https://dev.azure.com/azclitools/public/_build/results?buildId=140563&view=artifacts&pathAsName=false&type=publishedArtifacts

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved. Compute az vm/vmss/image/disk/snapshot
Projects
None yet
4 participants