Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ Release History

* GA Release Large File Shares property for storage account create and update command
* GA Release User Delegation SAS token Support
* Add new commands `az storage account blob-service-properties show` and `az storage account blob-service-properties update --enable-change-feed` to manage blob service properties for storage account.

2.0.77
++++++

**ACR**

* Deprecated paramater `--branch` from acr task create/update
* Deprecated parameter `--branch` from acr task create/update

**Azure Red Hat OpenShift**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,9 @@ def cf_blob_container_mgmt(cli_ctx, _):
return storage_client_factory(cli_ctx).blob_containers


def cf_mgmt_blob_services(cli_ctx, _):
return storage_client_factory(cli_ctx).blob_services


def cf_blob_data_gen_update(cli_ctx, kwargs):
return blob_data_service_factory(cli_ctx, kwargs.copy())
32 changes: 32 additions & 0 deletions src/azure-cli/azure/cli/command_modules/storage/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,38 @@
short-summary: Manage storage accounts.
"""

helps['storage account blob-service-properties'] = """
type: group
short-summary: Manage the properties of a storage account's blob service.
"""

helps['storage account blob-service-properties show'] = """
type: command
short-summary: Show the properties of a storage account's blob service.
long-summary: >
Show the properties of a storage account's blob service, including
properties for Storage Analytics and CORS (Cross-Origin Resource
Sharing) rules.
examples:
- name: Show the properties of the storage account 'MyStorageAccount' in resource group 'MyResourceGroup'.
text: az storage account blob-service-properties show -n MyStorageAccount -g MyResourceGroup
"""

helps['storage account blob-service-properties update'] = """
type: command
short-summary: Update the properties of a storage account's blob service.
long-summary: >
Update the properties of a storage account's blob service, including
properties for Storage Analytics and CORS (Cross-Origin Resource
Sharing) rules. But currently we only support enabling or disabling change feed for a storage account's blob service.
parameters:
- name: --enable-change-feed
short-summary: 'Indicate whether change feed event logging is enabled. If it is true, you enable the storage account to begin capturing changes. The default value is true. You can see more details in https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-change-feed?tabs=azure-portal#register-by-using-azure-cli'
examples:
- name: Enable the change feed for the storage account 'MyStorageAccount' in resource group 'MyResourceGroup'.
text: az storage account blob-service-properties update --enable-change-feed true -n MyStorageAccount -g MyResourceGroup
"""

helps['storage account create'] = """
type: command
short-summary: Create a storage account.
Expand Down
11 changes: 11 additions & 0 deletions src/azure-cli/azure/cli/command_modules/storage/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.argument('vnet_name', help='Name of a virtual network.', validator=validate_subnet)
c.argument('action', help='The action of virtual network rule.')

with self.argument_context('storage account blob-service-properties show',
resource_type=ResourceType.MGMT_STORAGE) as c:
c.argument('account_name', acct_name_type, id_part=None)
c.argument('resource_group_name', required=False, validator=process_resource_group)

with self.argument_context('storage account blob-service-properties update',
resource_type=ResourceType.MGMT_STORAGE) as c:
c.argument('account_name', acct_name_type, id_part=None)
c.argument('resource_group_name', required=False, validator=process_resource_group)
c.argument('enable_change_feed', arg_type=get_three_state_flag(), min_api='2019-04-01')

with self.argument_context('storage account generate-sas') as c:
t_account_permissions = self.get_sdk('common.models#AccountPermissions')
c.register_sas_arguments()
Expand Down
18 changes: 17 additions & 1 deletion src/azure-cli/azure/cli/command_modules/storage/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
cloud_storage_account_service_factory,
multi_service_properties_factory,
cf_mgmt_policy,
cf_blob_data_gen_update, cf_sa_for_keys)
cf_blob_data_gen_update, cf_sa_for_keys,
cf_mgmt_blob_services)
from azure.cli.command_modules.storage.sdkutil import cosmosdb_table_exists
from azure.cli.command_modules.storage._format import transform_immutability_policy
from azure.cli.core.commands import CliCommandType
Expand All @@ -24,6 +25,12 @@ def load_command_table(self, _): # pylint: disable=too-many-locals, too-many-st
resource_type=ResourceType.MGMT_STORAGE
)

blob_service_mgmt_sdk = CliCommandType(
operations_tmpl='azure.mgmt.storage.operations#BlobServicesOperations.{}',
client_factory=cf_mgmt_blob_services,
resource_type=ResourceType.MGMT_STORAGE
)

storage_account_sdk_keys = CliCommandType(
operations_tmpl='azure.mgmt.storage.operations#StorageAccountsOperations.{}',
client_factory=cf_sa_for_keys,
Expand Down Expand Up @@ -116,6 +123,15 @@ def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.DAT
g.custom_command('list', 'list_network_rules')
g.custom_command('remove', 'remove_network_rule')

with self.command_group('storage account blob-service-properties', blob_service_mgmt_sdk,
custom_command_type=storage_account_custom_type,
resource_type=ResourceType.MGMT_STORAGE, min_api='2018-07-01', is_preview=True) as g:
g.show_command('show', 'get_service_properties')
g.generic_update_command('update',
getter_name='get_service_properties',
setter_name='set_service_properties',
custom_func_name='update_blob_service_properties')

with self.command_group('storage logging', get_custom_sdk('logging', multi_service_properties_factory)) as g:
from ._transformers import transform_logging_list_output
g.storage_command('update', 'set_logging')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,10 @@ def update_management_policies(client, resource_group_name, account_name, parame
if parameters:
parameters = parameters.policy
return client.create_or_update(resource_group_name, account_name, policy=parameters)


# TODO: support updating other properties besides 'enable_change_feed'
def update_blob_service_properties(cmd, instance, enable_change_feed=None):
if enable_change_feed is not None:
instance.change_feed = cmd.get_models('ChangeFeed')(enabled=enable_change_feed)
return instance
Loading