Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def default_api_version(self):

AZURE_API_PROFILES = {
'latest': {
ResourceType.MGMT_STORAGE: '2019-06-01',
ResourceType.MGMT_STORAGE: '2021-01-01',
ResourceType.MGMT_NETWORK: '2020-07-01',
ResourceType.MGMT_COMPUTE: SDKProfile('2020-06-01', {
'resource_skus': '2019-04-01',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
with self.argument_context('storage account update', resource_type=ResourceType.MGMT_STORAGE) as c:
t_tls_version = self.get_models('MinimumTlsVersion', resource_type=ResourceType.MGMT_STORAGE)
c.register_common_storage_account_options()
c.argument('sku', arg_type=get_enum_type(t_sku_name),
help='Note that the SKU name cannot be updated to Standard_ZRS, Premium_LRS or Premium_ZRS, '
'nor can accounts of those SKU names be updated to any other value')
c.argument('custom_domain',
help='User domain assigned to the storage account. Name is the CNAME source. Use "" to clear '
'existing value.',
Expand Down Expand Up @@ -451,8 +454,11 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
min_api='2019-06-01', help='Enable file service properties for share soft delete.')
c.argument('delete_retention_days', type=int, arg_group='Delete Retention Policy',
validator=validate_file_delete_retention_days, min_api='2019-06-01',
help=' Indicate the number of days that the deleted item should be retained. The minimum specified '
help='Indicate the number of days that the deleted item should be retained. The minimum specified '
'value can be 1 and the maximum value can be 365.')
c.argument('enable_smb_multichannel', options_list=['--enable-smb-multichannel', '--mc'],
arg_type=get_three_state_flag(), min_api='2020-08-01-preview',
help='Set SMB Multichannel setting for file service. Applies to Premium FileStorage only.')

with self.argument_context('storage account generate-sas') as c:
from ._validators import get_not_none_validator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create_storage_account(cmd, resource_group_name, account_name, sku=None, loc
if access_tier:
params.access_tier = AccessTier(access_tier)
if assign_identity:
params.identity = Identity()
params.identity = Identity(type='SystemAssigned')
if https_only is not None:
params.enable_https_traffic_only = https_only
if enable_hierarchical_namespace is not None:
Expand Down Expand Up @@ -321,7 +321,7 @@ def update_storage_account(cmd, instance, sku=None, tags=None, custom_domain=Non
origin_storage_account.azure_files_identity_based_authentication

if assign_identity:
params.identity = Identity()
params.identity = Identity(type='SystemAssigned')
if enable_large_file_share:
LargeFileSharesState = cmd.get_models('LargeFileSharesState')
params.large_file_shares_state = LargeFileSharesState("Enabled")
Expand Down Expand Up @@ -516,8 +516,9 @@ def update_blob_service_properties(cmd, instance, enable_change_feed=None, enabl


def update_file_service_properties(cmd, instance, enable_delete_retention=None,
delete_retention_days=None):
delete_retention_days=None, enable_smb_multichannel=None):
from azure.cli.core.azclierror import ValidationError
params = {}
# set delete retention policy according input
if enable_delete_retention is not None:
if enable_delete_retention is False:
Expand All @@ -538,8 +539,18 @@ def update_file_service_properties(cmd, instance, enable_delete_retention=None,
# TODO: remove it when server side return null not 0 for days
if instance.share_delete_retention_policy is not None and instance.share_delete_retention_policy.enabled is False:
instance.share_delete_retention_policy.days = None
if instance.share_delete_retention_policy:
params['share_delete_retention_policy'] = instance.share_delete_retention_policy

return instance
# set protocol settings
if enable_smb_multichannel is not None:
instance.protocol_settings = cmd.get_models('ProtocolSettings')()
instance.protocol_settings.smb = cmd.get_models('SmbSetting')(
multichannel=cmd.get_models('Multichannel')(enabled=enable_smb_multichannel))
if instance.protocol_settings.smb.multichannel:
params['protocol_settings'] = instance.protocol_settings

return params


def create_encryption_scope(cmd, client, resource_group_name, account_name, encryption_scope_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,19 @@ def create_share_rm(cmd, client, resource_group_name, account_name, share_name,
file_share.access_tier = access_tier

return client.create(resource_group_name=resource_group_name, account_name=account_name, share_name=share_name,
file_share=file_share)
file_share=file_share, expand=None)


def get_stats(client, resource_group_name, account_name, share_name):
return client.get(resource_group_name=resource_group_name, account_name=account_name, share_name=share_name,
expand='stats')


def list_share_rm(client, resource_group_name, account_name, include_deleted=None):
def list_share_rm(cmd, client, resource_group_name, account_name, include_deleted=None):
ListSharesExpand = cmd.get_models('ListSharesExpand')
if include_deleted:
return client.list(resource_group_name=resource_group_name, account_name=account_name)
return client.list(resource_group_name=resource_group_name, account_name=account_name,
expand=ListSharesExpand.DELETED)

return client.list(resource_group_name=resource_group_name, account_name=account_name, expand=None)

Expand Down
Loading