Skip to content

Conversation

@calvinhzy
Copy link
Member

@calvinhzy calvinhzy commented Jan 8, 2026

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.

…smb-encryption-in-transit` and `--require-nfs-encryption-in-transit`
@calvinhzy calvinhzy self-assigned this Jan 8, 2026
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jan 8, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jan 8, 2026

⚠️AzureCLI-BreakingChangeTest
⚠️storage
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd storage account file-service-properties update cmd storage account file-service-properties update added parameter require_nfs_encryption_in_transit
⚠️ 1006 - ParaAdd storage account file-service-properties update cmd storage account file-service-properties update added parameter require_smb_encryption_in_transit

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 8, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@microsoft-github-policy-service microsoft-github-policy-service bot added the Auto-Assign Auto assign by bot label Jan 8, 2026
@calvinhzy calvinhzy marked this pull request as ready for review January 8, 2026 09:28
@calvinhzy calvinhzy requested a review from jsntcy as a code owner January 8, 2026 09:28
Copilot AI review requested due to automatic review settings January 8, 2026 09:28
@calvinhzy calvinhzy requested a review from zhoxing-ms as a code owner January 8, 2026 09:28
Copy link
Contributor

Copilot AI left a 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-transit and --require-nfs-encryption-in-transit parameters to the az storage account file-service-properties update command
  • 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.

Comment on lines +966 to +969
elif not instance.protocol_settings.smb:
instance.protocol_settings.smb = smbSetting()
elif not instance.protocol_settings.nfs:
instance.protocol_settings.nfs = nfsSetting()
Copy link

Copilot AI Jan 8, 2026

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
Comment on lines +962 to +969
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()
Copy link

Copilot AI Jan 8, 2026

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
Comment on lines +989 to +990
(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()))):
Copy link

Copilot AI Jan 8, 2026

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()))

Suggested change
(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())))):

Copilot uses AI. Check for mistakes.
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 Storage az storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants