Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.99k forks source link

You forgot to add support for NFS into az webapp config storage-account command #28836

Open caroysMSFT opened 6 months ago

caroysMSFT commented 6 months ago

Describe the bug

When you go to add a storage account via:

https://learn.microsoft.com/en-us/cli/azure/webapp/config/storage-account?view=azure-cli-latest#az-webapp-config-storage-account-add

It only does SMB. NFS is now supported.

The underlying REST API states support for NFS - and it works as well (ask me for my powershell script!):

https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/update-azure-storage-accounts?view=rest-appservice-2023-12-01&tabs=HTTP#request-body

Related command

az webapp config storage-account command

Errors

Doesn't let you specify NFS. It assumes you are using SMB, and doesn't give you any option to specify NFS. See this output:

{ "filestorage": { "accessKey": "(redacted)", "accountName": "carypremium", "mountPath": "/mnt/filestorage", "protocol": "Smb", "shareName": "carynfsshare", "state": "NotValidated", "type": "AzureFiles" } }

Issue script & Debug output

az webapp config storage-account add --resource-group MyResourceGroup --name carylinux --custom-id filestorage --storage-type AzureFiles --account-name carypremium --share-name carynfsshare --access-key (redacted) --mount-path /mnt/filestorage az : D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated At line:1 char:1

{ "filestorage": { "accessKey": "(redacted)", "accountName": "carypremium", "mountPath": "/mnt/filestorage", "protocol": "Smb", "shareName": "carynfsshare", "state": "NotValidated", "type": "AzureFiles" } }

When you try to pass --protocol nfs, you get this:

ERROR: unrecognized arguments: --protocol nfs Examples from AI knowledge base: az webapp config storage-account add --access-key MyAccessKey --account-name MyStorageAccount --custom-id CustomId --name MyUniqueApp --resource-group MyResourceGroup --share-name MyShare --storage-type AzureFiles Add an Azure storage account configuration to a web app. (Linux Web Apps and Windows Containers Web Apps Only) (autogenerated) az webapp config storage-account add --resource-group MyResourceGroup --name MyUniqueApp --custom-id CustomId --storage-type AzureFiles --account-name MyStorageAccount --share-name MyShare --access-key MyAccessKey --mount-path /path/to/mount Add a connection to the Azure Files file share called MyShare in the storage account named MyStorageAccount. https://docs.microsoft.com/en-US/cli/azure/webapp/config/storage-account#az_webapp_config_storage_account_add Read more about the command in reference docs

Expected behavior

This should allow you to specify -protocol. This is of course successful when you go out and hit the REST API.

Environment Summary

az --version azure-cli 2.59.0

core 2.59.0 telemetry 1.1.0

Extensions: azure-devops 0.25.0 datafactory 0.5.0 image-copy-extension 0.2.9

Dependencies: msal 1.27.0 azure-mgmt-resource 23.1.0b2

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' Extensions directory 'C:\Users\caroys.azure\cliextensions'

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 21:52:07) [MSC v.1937 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

yonzhan commented 6 months ago

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

microsoft-github-policy-service[bot] commented 6 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.

microsoft-github-policy-service[bot] commented 6 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.

poizan42 commented 4 months ago

Btw. "protocol": "Nfs" works with AzureBlobs as well even though you can't choose it through the Azure Portal UI. az webapp config storage-account ... should just add a --storage-protocol argument to set the protocol value.