Skip to content
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

[storage-preview] az storage account create/update: Support --sam-account-name and --account-type #4316

Merged
merged 15 commits into from
Jan 14, 2022
Merged
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 @@ -77,6 +77,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 @@ -202,6 +209,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 @@ -300,6 +309,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
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