Skip to content

Commit

Permalink
[storage-preview] az storage account create/update: Support `--sam-…
Browse files Browse the repository at this point in the history
…account-name` and `--account-type` (#4316)

* Bump `azure-mgmt-storage` to 2021-08-01

* linter

* update SDK

* Update SDK

* Copy `az storage account create/update` from CLI main repo

* `az storage account create/update`: Support `--enable-sftp` and `--enable-local-user`

* update sdk

* fix test

* re-record test

* `az storage account create/update`: Support `--sam-account-name` and `--account-type`

* add test
  • Loading branch information
evelyn-ys authored Jan 14, 2022
1 parent 350baa0 commit 224c7ee
Show file tree
Hide file tree
Showing 4 changed files with 382 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/storage-preview/azext_storage_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
azure_storage_sid_type = CLIArgumentType(min_api='2019-04-01', arg_group="Azure Active Directory Properties",
help="Specify the security identifier (SID) for Azure Storage. "
"Required when --enable-files-adds is set to True")
sam_account_name_type = CLIArgumentType(min_api='2021-08-01', arg_group="Azure Active Directory Properties",
help="Specify the Active Directory SAMAccountName for Azure Storage.",
is_preview=True)
t_account_type = self.get_models('ActiveDirectoryPropertiesAccountType', resource_type=CUSTOM_MGMT_STORAGE)
account_type_type = CLIArgumentType(min_api='2021-08-01', arg_group="Azure Active Directory Properties",
arg_type=get_enum_type(t_account_type), is_preview=True,
help="Specify the Active Directory account type for Azure Storage.")
t_routing_choice = self.get_models('RoutingChoice', resource_type=CUSTOM_MGMT_STORAGE)
routing_choice_type = CLIArgumentType(
arg_group='Routing Preference', arg_type=get_enum_type(t_routing_choice),
Expand Down Expand Up @@ -203,6 +210,8 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.argument('domain_guid', domain_guid_type)
c.argument('domain_sid', domain_sid_type)
c.argument('azure_storage_sid', azure_storage_sid_type)
c.argument('sam_account_name', sam_account_name_type)
c.argument('account_type', account_type_type)
c.argument('enable_hierarchical_namespace', arg_type=get_three_state_flag(),
options_list=['--enable-hierarchical-namespace', '--hns',
c.deprecate(target='--hierarchical-namespace', redirect='--hns', hide=True)],
Expand Down Expand Up @@ -301,6 +310,8 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.argument('domain_guid', domain_guid_type)
c.argument('domain_sid', domain_sid_type)
c.argument('azure_storage_sid', azure_storage_sid_type)
c.argument('sam_account_name', sam_account_name_type)
c.argument('account_type', account_type_type)
c.argument('routing_choice', routing_choice_type)
c.argument('publish_microsoft_endpoints', publish_microsoft_endpoints_type)
c.argument('publish_internet_endpoints', publish_internet_endpoints_type)
Expand Down
13 changes: 9 additions & 4 deletions src/storage-preview/azext_storage_preview/operations/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def create_storage_account(cmd, resource_group_name, account_name, sku=None, loc
enable_files_aadds=None, bypass=None, default_action=None, assign_identity=False,
enable_large_file_share=None, enable_files_adds=None, domain_name=None,
net_bios_domain_name=None, forest_name=None, domain_guid=None, domain_sid=None,
sam_account_name=None, account_type=None,
azure_storage_sid=None, enable_hierarchical_namespace=None,
encryption_key_type_for_table=None, encryption_key_type_for_queue=None,
routing_choice=None, publish_microsoft_endpoints=None, publish_internet_endpoints=None,
Expand Down Expand Up @@ -102,7 +103,9 @@ def create_storage_account(cmd, resource_group_name, account_name, sku=None, loc
net_bios_domain_name=net_bios_domain_name,
forest_name=forest_name, domain_guid=domain_guid,
domain_sid=domain_sid,
azure_storage_sid=azure_storage_sid)
azure_storage_sid=azure_storage_sid,
sam_account_name=sam_account_name,
account_type=account_type)
# TODO: Enabling AD will automatically disable AADDS. Maybe we should throw error message

params.azure_files_identity_based_authentication = AzureFilesIdentityBasedAuthentication(
Expand Down Expand Up @@ -276,8 +279,8 @@ def update_storage_account(cmd, instance, sku=None, tags=None, custom_domain=Non
enable_files_aadds=None, assign_identity=False,
bypass=None, default_action=None, enable_large_file_share=None, enable_files_adds=None,
domain_name=None, net_bios_domain_name=None, forest_name=None, domain_guid=None,
domain_sid=None, azure_storage_sid=None, routing_choice=None,
publish_microsoft_endpoints=None, publish_internet_endpoints=None,
domain_sid=None, azure_storage_sid=None, sam_account_name=None, account_type=None,
routing_choice=None, publish_microsoft_endpoints=None, publish_internet_endpoints=None,
allow_blob_public_access=None, min_tls_version=None, allow_shared_key_access=None,
identity_type=None, user_identity_id=None, key_vault_user_identity_id=None,
sas_expiration_period=None, key_expiration_period_in_days=None,
Expand Down Expand Up @@ -387,7 +390,9 @@ def update_storage_account(cmd, instance, sku=None, tags=None, custom_domain=Non
net_bios_domain_name=net_bios_domain_name,
forest_name=forest_name, domain_guid=domain_guid,
domain_sid=domain_sid,
azure_storage_sid=azure_storage_sid)
azure_storage_sid=azure_storage_sid,
sam_account_name=sam_account_name,
account_type=account_type)
# TODO: Enabling AD will automatically disable AADDS. Maybe we should throw error message

params.azure_files_identity_based_authentication = AzureFilesIdentityBasedAuthentication(
Expand Down
Loading

0 comments on commit 224c7ee

Please sign in to comment.