-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Storage] az storage account file-service-properties update: Add `--require-smb-encryption-in-transit and --require-nfs-encryption-in-transit
#32619
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
base: dev
Are you sure you want to change the base?
Conversation
…smb-encryption-in-transit` and `--require-nfs-encryption-in-transit`
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| storage account file-service-properties update | cmd storage account file-service-properties update added parameter require_nfs_encryption_in_transit |
||
| storage account file-service-properties update | cmd storage account file-service-properties update added parameter require_smb_encryption_in_transit |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for separate encryption-in-transit requirements for SMB and NFS protocols in Azure Storage file service properties. Previously, there was only a general secure transfer requirement at the account level; this change allows granular control for different protocols.
Key changes:
- Added
--require-smb-encryption-in-transitand--require-nfs-encryption-in-transitparameters to theaz storage account file-service-properties updatecommand - Extended the backend implementation to handle NFS protocol settings alongside existing SMB settings
- Added comprehensive test coverage for the new parameters
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
_params.py |
Added parameter definitions for SMB and NFS encryption-in-transit flags with appropriate help text and short options |
operations/account.py |
Extended update_file_service_properties to initialize and configure NFS settings and handle encryption-in-transit for both protocols |
test_storage_account_scenarios.py |
Added comprehensive test case covering various combinations of the new parameters |
test_storage_account_file_smb_nfs_encryption_in_transit.yaml |
Added test recording for the new test case |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| elif not instance.protocol_settings.smb: | ||
| instance.protocol_settings.smb = smbSetting() | ||
| elif not instance.protocol_settings.nfs: | ||
| instance.protocol_settings.nfs = nfsSetting() |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initialization logic for protocol settings has a flaw. Lines 966-969 use elif statements, which means if instance.protocol_settings.smb is missing, the code will initialize it but skip checking instance.protocol_settings.nfs. Both settings should be initialized independently. The conditions should be separate if statements instead of elif.
| elif not instance.protocol_settings.smb: | |
| instance.protocol_settings.smb = smbSetting() | |
| elif not instance.protocol_settings.nfs: | |
| instance.protocol_settings.nfs = nfsSetting() | |
| else: | |
| if not instance.protocol_settings.smb: | |
| instance.protocol_settings.smb = smbSetting() | |
| if not instance.protocol_settings.nfs: | |
| instance.protocol_settings.nfs = nfsSetting() |
| smbSetting = cmd.get_models('SmbSetting') | ||
| nfsSetting = cmd.get_models('NfsSetting') | ||
| if not instance.protocol_settings: | ||
| instance.protocol_settings = cmd.get_models('ProtocolSettings')(smb=smbSetting(), nfs=nfsSetting()) | ||
| elif not instance.protocol_settings.smb: | ||
| instance.protocol_settings.smb = smbSetting() | ||
| elif not instance.protocol_settings.nfs: | ||
| instance.protocol_settings.nfs = nfsSetting() |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable names should follow Python naming conventions. The variables smbSetting and nfsSetting should be smb_setting and nfs_setting to follow snake_case naming convention.
| smbSetting = cmd.get_models('SmbSetting') | |
| nfsSetting = cmd.get_models('NfsSetting') | |
| if not instance.protocol_settings: | |
| instance.protocol_settings = cmd.get_models('ProtocolSettings')(smb=smbSetting(), nfs=nfsSetting()) | |
| elif not instance.protocol_settings.smb: | |
| instance.protocol_settings.smb = smbSetting() | |
| elif not instance.protocol_settings.nfs: | |
| instance.protocol_settings.nfs = nfsSetting() | |
| smb_setting = cmd.get_models('SmbSetting') | |
| nfs_setting = cmd.get_models('NfsSetting') | |
| if not instance.protocol_settings: | |
| instance.protocol_settings = cmd.get_models('ProtocolSettings')(smb=smb_setting(), nfs=nfs_setting()) | |
| elif not instance.protocol_settings.smb: | |
| instance.protocol_settings.smb = smb_setting() | |
| elif not instance.protocol_settings.nfs: | |
| instance.protocol_settings.nfs = nfs_setting() |
| (instance.protocol_settings.smb and any(instance.protocol_settings.smb.__dict__.values()) or | ||
| instance.protocol_settings.nfs and any(instance.protocol_settings.nfs.__dict__.values()))): |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional expression needs parentheses for proper operator precedence. The or operator has lower precedence than and, which could lead to incorrect evaluation. The condition should be:
(instance.protocol_settings.smb and any(instance.protocol_settings.smb.__dict__.values())) or (instance.protocol_settings.nfs and any(instance.protocol_settings.nfs.__dict__.values()))
| (instance.protocol_settings.smb and any(instance.protocol_settings.smb.__dict__.values()) or | |
| instance.protocol_settings.nfs and any(instance.protocol_settings.nfs.__dict__.values()))): | |
| ((instance.protocol_settings.smb and any(instance.protocol_settings.smb.__dict__.values())) or | |
| (instance.protocol_settings.nfs and any(instance.protocol_settings.nfs.__dict__.values())))): |
Related command
Description
Support separate settings to require secure transfer for REST API operations vs smb operations vs nfs operations
Testing Guide
History Notes
[Storage]
az storage account file-service-properties update: Add ``--require-smb-encryption-in-transitand--require-nfs-encryption-in-transit`This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.