Skip to content

Commit

Permalink
[Storage] Fix Azure#22704: az storage account create: `--encryption…
Browse files Browse the repository at this point in the history
…-key-type-for-queue` and `--encryption-key-type-for-table` no longer remove other settings (Azure#26853)

* only create obj if not exist

* take into account of server fix for empty blob dict
  • Loading branch information
calvinhzy committed Jul 21, 2023
1 parent 698b9cd commit 4a04446
Show file tree
Hide file tree
Showing 2 changed files with 485 additions and 27 deletions.
Expand Up @@ -205,14 +205,22 @@ def create_storage_account(cmd, resource_group_name, account_name, sku=None, loc
if encryption_key_type_for_table is not None or encryption_key_type_for_queue is not None:
EncryptionServices = cmd.get_models('EncryptionServices')
EncryptionService = cmd.get_models('EncryptionService')
params.encryption = Encryption()
params.encryption.services = EncryptionServices()
if params.encryption is None:
params.encryption = Encryption()
if params.encryption.services is None:
params.encryption.services = EncryptionServices()
if encryption_key_type_for_table is not None:
table_encryption_service = EncryptionService(enabled=True, key_type=encryption_key_type_for_table)
params.encryption.services.table = table_encryption_service
if isinstance(params.encryption.services, dict):
params.encryption.services["table"] = table_encryption_service
else:
params.encryption.services.table = table_encryption_service
if encryption_key_type_for_queue is not None:
queue_encryption_service = EncryptionService(enabled=True, key_type=encryption_key_type_for_queue)
params.encryption.services.queue = queue_encryption_service
if isinstance(params.encryption.services, dict):
params.encryption.services["queue"] = queue_encryption_service
else:
params.encryption.services.queue = queue_encryption_service

if any([routing_choice, publish_microsoft_endpoints, publish_internet_endpoints]):
RoutingPreference = cmd.get_models('RoutingPreference')
Expand Down

0 comments on commit 4a04446

Please sign in to comment.