diff --git a/src/azure-cli/azure/cli/command_modules/monitor/_client_factory.py b/src/azure-cli/azure/cli/command_modules/monitor/_client_factory.py index d1cc6ecaa67..89ca739ff1e 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/_client_factory.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/_client_factory.py @@ -119,3 +119,7 @@ def cf_log_analytics_workspace_linked_service(cli_ctx, _): def cf_log_analytics_cluster(cli_ctx, _): return _log_analytics_client_factory(cli_ctx).clusters + + +def cf_log_analytics_linked_storage(cli_ctx, _): + return _log_analytics_client_factory(cli_ctx).linked_storage_accounts diff --git a/src/azure-cli/azure/cli/command_modules/monitor/_help.py b/src/azure-cli/azure/cli/command_modules/monitor/_help.py index 6ef1a7494a3..27b60dffc8b 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/_help.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/_help.py @@ -1103,6 +1103,60 @@ text: az monitor log-analytics workspace linked-service wait -n cluster -g MyResourceGroup --workspace-name MyWorkspace --created """ +helps['monitor log-analytics workspace linked-storage'] = """ +type: group +short-summary: Manage linked storage account for log analytics workspace. +""" + +helps['monitor log-analytics workspace linked-storage create'] = """ +type: command +short-summary: Create some linked storage accounts for log analytics workspace. +examples: + - name: Create two linked storage accounts for a log analytics workspace + text: az monitor log-analytics workspace linked-storage create --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts SA1 SA2 +""" + +helps['monitor log-analytics workspace linked-storage delete'] = """ +type: command +short-summary: Delete all linked storage accounts with specific data source type for log analytics workspace. +examples: + - name: Delete all linked storage accounts with a specific type for a log analytics workspace + text: az monitor log-analytics workspace linked-storage delete --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace +""" + +helps['monitor log-analytics workspace linked-storage add'] = """ +type: command +short-summary: Add some linked storage accounts with specific data source type for log analytics workspace. +examples: + - name: Add two linked storage accounts for a log analytics workspace + text: az monitor log-analytics workspace linked-storage add --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts SA1 SA2 +""" + +helps['monitor log-analytics workspace linked-storage remove'] = """ +type: command +short-summary: Remove some linked storage accounts with specific data source type for log analytics workspace +examples: + - name: Remove two linked storage accounts for a log analytics workspace + text: az monitor log-analytics workspace linked-storage remove --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts SA1 SA2. +""" + +helps['monitor log-analytics workspace linked-storage list'] = """ +type: command +short-summary: List all linked storage accounts for a log analytics workspace. +examples: + - name: List all linked storage accounts for a log analytics workspace + text: az monitor log-analytics workspace linked-storage list -g MyResourceGroup --workspace-name MyWorkspace + +""" + +helps['monitor log-analytics workspace linked-storage show'] = """ +type: command +short-summary: List all linked storage accounts with specific data source type for a log analytics workspace. +examples: + - name: Show all linked storage accounts with a specific type for a log analytics workspace + text: az monitor log-analytics workspace linked-storage show --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace +""" + helps['monitor log-profiles'] = """ type: group short-summary: Manage log profiles. diff --git a/src/azure-cli/azure/cli/command_modules/monitor/_params.py b/src/azure-cli/azure/cli/command_modules/monitor/_params.py index 19fe4c80037..5f7f2eef55d 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/_params.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/_params.py @@ -16,7 +16,7 @@ from azure.cli.command_modules.monitor.util import get_operator_map, get_aggregation_map from azure.cli.command_modules.monitor.validators import ( process_webhook_prop, validate_autoscale_recurrence, validate_autoscale_timegrain, get_action_group_validator, - get_action_group_id_validator, validate_metric_dimension) + get_action_group_id_validator, validate_metric_dimension, validate_storage_accounts_name_or_id) from knack.arguments import CLIArgumentType @@ -339,6 +339,11 @@ def load_arguments(self, _): c.argument('workspace_name', options_list=['--workspace-name', '-n'], help="Name of the Log Analytics Workspace.") c.ignore('sku') c.argument('retention_time', help="The workspace data retention in days.", type=int, default=30) + from azure.mgmt.loganalytics.models import PublicNetworkAccessType + c.argument('public_network_access_for_ingestion', options_list=['--ingestion-access'], help='The public network access type to access workspace ingestion.', + arg_type=get_enum_type(PublicNetworkAccessType)) + c.argument('public_network_access_for_query', options_list=['--query-access'], help='The public network access type to access workspace query.', + arg_type=get_enum_type(PublicNetworkAccessType)) with self.argument_context('monitor log-analytics workspace pack') as c: c.argument('intelligence_pack_name', options_list=['--name', '-n']) @@ -371,6 +376,16 @@ def load_arguments(self, _): c.argument('key_version', help='The version of the key associated with the Log Analytics cluster.') # endregion + # region Log Analytics Linked Storage Account + with self.argument_context('monitor log-analytics workspace linked-storage') as c: + from azure.mgmt.loganalytics.models import DataSourceType + c.argument('data_source_type', help='Data source type for the linked storage account.', + options_list=['--type'], arg_type=get_enum_type(DataSourceType)) + c.argument('storage_account_ids', nargs='+', options_list=['--storage-accounts'], + help='List of Name or ID of Azure Storage Account.', + validator=validate_storage_accounts_name_or_id) + # endregion + # region monitor clone with self.argument_context('monitor clone') as c: c.argument('source_resource', help="Resource ID of the source resource.") diff --git a/src/azure-cli/azure/cli/command_modules/monitor/commands.py b/src/azure-cli/azure/cli/command_modules/monitor/commands.py index 461edc614d5..62b217ecaf6 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/commands.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/commands.py @@ -17,7 +17,7 @@ def load_command_table(self, _): cf_log_analytics_workspace_intelligence_packs, cf_log_analytics_cluster, cf_log_analytics_workspace_linked_service, cf_diagnostics_category, cf_private_link_resources, cf_private_link_scoped_resources, - cf_private_link_scopes, cf_private_endpoint_connections) + cf_private_link_scopes, cf_private_endpoint_connections, cf_log_analytics_linked_storage) from ._exception_handler import monitor_exception_handler, missing_resource_handler from .transformers import (action_group_list_table) from .validators import process_autoscale_create_namespace, validate_private_endpoint_connection_id,\ @@ -229,6 +229,18 @@ def load_command_table(self, _): exception_handler=monitor_exception_handler ) + log_analytics_linked_storage_sdk = CliCommandType( + operations_tmpl='azure.mgmt.loganalytics.operations#LinkedStorageAccountsOperations.{}', + client_factory=cf_log_analytics_linked_storage, + exception_handler=monitor_exception_handler + ) + + log_analytics_linked_storage_custom = CliCommandType( + operations_tmpl='azure.cli.command_modules.monitor.operations.log_analytics_linked_storage_account#{}', + client_factory=cf_log_analytics_linked_storage, + exception_handler=monitor_exception_handler + ) + monitor_general_custom = CliCommandType( operations_tmpl='azure.cli.command_modules.monitor.operations.general_operations#{}', client_factory=cf_metric_alerts, @@ -345,7 +357,7 @@ def load_command_table(self, _): g.command('enable', 'enable') g.command('disable', 'disable') - with self.command_group('monitor log-analytics workspace linked-service', log_analytics_workspace_linked_service_sdk, custom_command_type=log_analytics_workspace_linked_service_custom) as g: + with self.command_group('monitor log-analytics workspace linked-service', log_analytics_workspace_linked_service_sdk, custom_command_type=log_analytics_workspace_linked_service_custom, is_preview=True) as g: g.custom_command('create', 'create_log_analytics_workspace_linked_service', supports_no_wait=True) g.generic_update_command('update', custom_func_name='update_log_analytics_workspace_linked_service', supports_no_wait=True) g.show_command('show', 'get') @@ -361,28 +373,36 @@ def load_command_table(self, _): g.custom_command('list', 'list_log_analytics_clusters') g.wait_command('wait') - with self.command_group('monitor', metric_alert_sdk, custom_command_type=monitor_general_custom, is_preview=True) as g: - g.custom_command('clone', 'clone_existed_settings') + with self.command_group('monitor log-analytics workspace linked-storage', log_analytics_linked_storage_sdk, custom_command_type=log_analytics_linked_storage_custom, is_preview=True) as g: + g.command('create', 'create_or_update') + g.custom_command('add', 'add_log_analytics_workspace_linked_storage_accounts') + g.custom_command('remove', 'remove_log_analytics_workspace_linked_storage_accounts') + g.command('delete', 'delete', confirmation=True) + g.show_command('show', 'get') + g.command('list', 'list_by_workspace') + + with self.command_group('monitor', metric_alert_sdk, custom_command_type=monitor_general_custom) as g: + g.custom_command('clone', 'clone_existed_settings', is_preview=True) - with self.command_group('monitor private-link-scope', private_link_scopes_sdk, custom_command_type=private_link_scope_custom) as g: + with self.command_group('monitor private-link-scope', private_link_scopes_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g: g.custom_show_command('show', 'show_private_link_scope') g.custom_command('list', 'list_private_link_scope') g.custom_command('create', 'create_private_link_scope') g.custom_command('update', 'update_private_link_scope') g.custom_command('delete', 'delete_private_link_scope', confirmation=True) - with self.command_group('monitor private-link-scope scoped-resource', private_link_scoped_resources_sdk, custom_command_type=private_link_scope_custom) as g: + with self.command_group('monitor private-link-scope scoped-resource', private_link_scoped_resources_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g: g.custom_show_command('show', 'show_private_link_scope_resource', client_factory=cf_private_link_scoped_resources) g.custom_command('list', 'list_private_link_scope_resource', client_factory=cf_private_link_scoped_resources) g.custom_command('create', 'create_private_link_scope_resource', client_factory=cf_private_link_scoped_resources) g.custom_command('delete', 'delete_private_link_scope_resource', client_factory=cf_private_link_scoped_resources, confirmation=True) - with self.command_group('monitor private-link-scope private-link-resource', private_link_resources_sdk, custom_command_type=private_link_scope_custom) as g: + with self.command_group('monitor private-link-scope private-link-resource', private_link_resources_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g: g.custom_show_command('show', 'show_private_link_resource', client_factory=cf_private_link_resources) from azure.cli.core.commands.transform import gen_dict_to_list_transform g.custom_command('list', 'list_private_link_resource', client_factory=cf_private_link_resources, transform=gen_dict_to_list_transform(key="value")) - with self.command_group('monitor private-link-scope private-endpoint-connection', private_endpoint_connections_sdk, custom_command_type=private_link_scope_custom) as g: + with self.command_group('monitor private-link-scope private-endpoint-connection', private_endpoint_connections_sdk, custom_command_type=private_link_scope_custom, is_preview=True) as g: g.custom_show_command('show', 'show_private_endpoint_connection', client_factory=cf_private_endpoint_connections, validator=validate_private_endpoint_connection_id) g.custom_command('list', 'list_private_endpoint_connection', client_factory=cf_private_endpoint_connections) diff --git a/src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_linked_storage_account.py b/src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_linked_storage_account.py new file mode 100644 index 00000000000..ea085552586 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_linked_storage_account.py @@ -0,0 +1,31 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def add_log_analytics_workspace_linked_storage_accounts(client, resource_group_name, workspace_name, + data_source_type, storage_account_ids): + linked_storage_accounts = client.get(resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_source_type=data_source_type) + linked_storage_accounts.storage_account_ids.extend(storage_account_ids) + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_source_type=data_source_type, + storage_account_ids=linked_storage_accounts.storage_account_ids) + + +def remove_log_analytics_workspace_linked_storage_accounts(client, resource_group_name, workspace_name, + data_source_type, storage_account_ids): + linked_storage_accounts = client.get(resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_source_type=data_source_type) + storage_account_ids_set = set(str.lower(storage_account_id) for storage_account_id in storage_account_ids) + for existed_storage_account_id in linked_storage_accounts.storage_account_ids: + if str.lower(existed_storage_account_id) in storage_account_ids_set: + linked_storage_accounts.storage_account_ids.remove(existed_storage_account_id) + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + data_source_type=data_source_type, + storage_account_ids=linked_storage_accounts.storage_account_ids) diff --git a/src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_workspace.py b/src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_workspace.py index e5e475f6187..df525515448 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_workspace.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/operations/log_analytics_workspace.py @@ -6,7 +6,8 @@ def create_log_analytics_workspace(cmd, client, resource_group_name, workspace_name, location=None, tags=None, - sku=WorkspaceSkuNameEnum.per_gb2018.value, retention_time=None): + sku=WorkspaceSkuNameEnum.per_gb2018.value, retention_time=None, + public_network_access_for_query=None, public_network_access_for_ingestion=None): from azure.mgmt.loganalytics.models import Workspace, WorkspaceSku from azure.cli.core.commands import LongRunningOperation workspace_client = client @@ -14,17 +15,24 @@ def create_log_analytics_workspace(cmd, client, resource_group_name, workspace_n workspace_instance = Workspace(location=location, tags=tags, sku=sku, - retention_in_days=retention_time) + retention_in_days=retention_time, + public_network_access_for_query=public_network_access_for_query, + public_network_access_for_ingestion=public_network_access_for_ingestion) return LongRunningOperation(cmd.cli_ctx)(workspace_client.create_or_update(resource_group_name, workspace_name, workspace_instance)) -def update_log_analytics_workspace(instance, tags=None, retention_time=None): +def update_log_analytics_workspace(instance, tags=None, retention_time=None, + public_network_access_for_query=None, public_network_access_for_ingestion=None): if tags is not None: instance.tags = tags if retention_time is not None: instance.retention_in_days = retention_time + if public_network_access_for_query is not None: + instance.public_network_access_for_query = public_network_access_for_query + if public_network_access_for_ingestion is not None: + instance.public_network_access_for_ingestion = public_network_access_for_ingestion return instance diff --git a/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_log_analytics_workspace_linked_storage.yaml b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_log_analytics_workspace_linked_storage.yaml new file mode 100644 index 00000000000..d87897d195e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_log_analytics_workspace_linked_storage.yaml @@ -0,0 +1,981 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace create + Connection: + - keep-alive + ParameterSetName: + - -g -n --tags + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-resource/9.0.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001","name":"cli_test_monitor_workspace_linked_storage000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2020-04-27T02:52:45Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '428' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:54:56 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"tags": {"clitest": "myron"}, "location": "eastus", "properties": {"sku": + {"name": "PerGB2018"}, "retentionInDays": 30}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace create + Connection: + - keep-alive + Content-Length: + - '121' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n --tags + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"b9106a12-d60f-40d1-ae48-fbd711ba8b31\",\r\n \"provisioningState\": \"Creating\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Mon, 27 Apr 2020 02:55:01 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n + \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n + \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": + \"Tue, 28 Apr 2020 00:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": + \"Enabled\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/microsoft.operationalinsights/workspaces/clitest000006\",\r\n + \ \"name\": \"clitest000006\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"clitest\": \"myron\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1069' + content-type: + - application/json + date: + - Mon, 27 Apr 2020 02:55:03 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace create + Connection: + - keep-alive + ParameterSetName: + - -g -n --tags + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"b9106a12-d60f-40d1-ae48-fbd711ba8b31\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Mon, 27 Apr 2020 02:55:01 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n + \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n + \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": + \"Tue, 28 Apr 2020 00:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": + \"Enabled\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/microsoft.operationalinsights/workspaces/clitest000006\",\r\n + \ \"name\": \"clitest000006\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"clitest\": \"myron\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1070' + content-type: + - application/json + date: + - Mon, 27 Apr 2020 02:55:34 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: 'b''b\''{"properties": {"storageAccountIds": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws1000002"]}}\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage create + Connection: + - keep-alive + Content-Length: + - '254' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --type -g -n --storage-accounts + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws1000002\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson\",\r\n + \ \"name\": \"azurewatson\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n}" + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '648' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:55:38 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage add + Connection: + - keep-alive + ParameterSetName: + - --type -g -n --storage-accounts + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"dataSourceType\": \"azurewatson\",\r\n + \ \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws1000002\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson\",\r\n + \ \"name\": \"azurewatson\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n}" + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '686' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:55:42 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: 'b''b\''b\\\''b\\\\\\\''{"properties": {"storageAccountIds": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws1000002", + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws2000003", + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws3000004"]}}\\\\\\\''\\\''\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage add + Connection: + - keep-alive + Content-Length: + - '684' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --type -g -n --storage-accounts + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws1000002\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws2000003\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws3000004\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson\",\r\n + \ \"name\": \"azurewatson\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n}" + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '1092' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:55:43 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage remove + Connection: + - keep-alive + ParameterSetName: + - --type -g -n --storage-accounts + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"dataSourceType\": \"azurewatson\",\r\n + \ \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws1000002\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws2000003\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws3000004\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson\",\r\n + \ \"name\": \"azurewatson\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n}" + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '1130' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:55:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: 'b''b\''b\\\''{"properties": {"storageAccountIds": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws2000003", + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws3000004"]}}\\\''\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage remove + Connection: + - keep-alive + Content-Length: + - '469' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --type -g -n --storage-accounts + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws2000003\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws3000004\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson\",\r\n + \ \"name\": \"azurewatson\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n}" + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '870' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:55:48 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage show + Connection: + - keep-alive + ParameterSetName: + - --type -g -n + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"dataSourceType\": \"azurewatson\",\r\n + \ \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws2000003\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws3000004\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/AzureWatson\",\r\n + \ \"name\": \"azurewatson\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n}" + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '908' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:55:51 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace create + Connection: + - keep-alive + ParameterSetName: + - -g -n --tags + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-resource/9.0.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001","name":"cli_test_monitor_workspace_linked_storage000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2020-04-27T02:52:45Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '428' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:55:53 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"tags": {"clitest": "myron"}, "location": "eastus", "properties": {"sku": + {"name": "PerGB2018"}, "retentionInDays": 30}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace create + Connection: + - keep-alive + Content-Length: + - '121' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n --tags + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000007?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"8ffaccb4-688f-46a6-84ce-bc714ca97f07\",\r\n \"provisioningState\": \"Creating\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Mon, 27 Apr 2020 02:56:02 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n + \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n + \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": + \"Mon, 27 Apr 2020 18:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": + \"Enabled\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/microsoft.operationalinsights/workspaces/clitest000007\",\r\n + \ \"name\": \"clitest000007\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"clitest\": \"myron\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1069' + content-type: + - application/json + date: + - Mon, 27 Apr 2020 02:56:03 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace create + Connection: + - keep-alive + ParameterSetName: + - -g -n --tags + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000007?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"8ffaccb4-688f-46a6-84ce-bc714ca97f07\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Mon, 27 Apr 2020 02:56:02 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n + \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n + \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": + \"Mon, 27 Apr 2020 18:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": + \"Enabled\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/microsoft.operationalinsights/workspaces/clitest000007\",\r\n + \ \"name\": \"clitest000007\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"clitest\": \"myron\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1070' + content-type: + - application/json + date: + - Mon, 27 Apr 2020 02:56:35 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: 'b''b\''b\\\''{"properties": {"storageAccountIds": ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws1000002", + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws4000005"]}}\\\''\''''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage create + Connection: + - keep-alive + Content-Length: + - '469' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --type -g -n --storage-accounts + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/CustomLogs?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws1000002\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws4000005\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/CustomLogs\",\r\n + \ \"name\": \"customlogs\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n}" + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '868' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:56:38 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage list + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"dataSourceType\": + \"azurewatson\",\r\n \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws2000003\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws3000004\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/azurewatson\",\r\n + \ \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n + \ },\r\n {\r\n \"properties\": {\r\n \"dataSourceType\": + \"customlogs\",\r\n \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws1000002\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws4000005\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/customlogs\",\r\n + \ \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n + \ }\r\n ]\r\n}" + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '1878' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:56:42 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --type -g -n -y + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/CustomLogs?api-version=2020-03-01-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '0' + date: + - Mon, 27 Apr 2020 02:56:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace linked-storage list + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"dataSourceType\": + \"azurewatson\",\r\n \"storageAccountIds\": [\r\n \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws2000003\",\r\n + \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.Storage/storageAccounts/saws3000004\"\r\n + \ ]\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_linked_storage000001/providers/Microsoft.OperationalInsights/workspaces/clitest000006/linkedStorageAccounts/azurewatson\",\r\n + \ \"type\": \"Microsoft.OperationalInsights/workspaces/linkedStorageAccounts\"\r\n + \ }\r\n ]\r\n}" + headers: + cache-control: + - no-cache + cachecontrol: + - no-cache + content-length: + - '951' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 27 Apr 2020 02:56:48 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-ams-apiversion: + - WebAPI1.0 + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_log_analytics_workspace_public_access.yaml b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_log_analytics_workspace_public_access.yaml new file mode 100644 index 00000000000..114dc191454 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_log_analytics_workspace_public_access.yaml @@ -0,0 +1,372 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace create + Connection: + - keep-alive + ParameterSetName: + - -g -n --tags --query-access --ingestion-access + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-resource/9.0.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_workspace_public_access000001","name":"cli_test_monitor_workspace_public_access000001","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{"product":"azurecli","cause":"automation","date":"2020-04-24T04:52:44Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '428' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 24 Apr 2020 04:52:52 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"tags": {"clitest": "myron"}, "location": "eastus", "properties": {"sku": + {"name": "PerGB2018"}, "retentionInDays": 30, "publicNetworkAccessForIngestion": + "Disabled", "publicNetworkAccessForQuery": "Disabled"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace create + Connection: + - keep-alive + Content-Length: + - '211' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n --tags --query-access --ingestion-access + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"c4893068-3f38-4fdb-93d4-f583177a3b83\",\r\n \"provisioningState\": \"Creating\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Fri, 24 Apr 2020 04:53:01 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n + \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n + \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": + \"Fri, 24 Apr 2020 09:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Disabled\",\r\n \"publicNetworkAccessForQuery\": + \"Disabled\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/microsoft.operationalinsights/workspaces/clitest000002\",\r\n + \ \"name\": \"clitest000002\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"clitest\": \"myron\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1071' + content-type: + - application/json + date: + - Fri, 24 Apr 2020 04:53:02 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace create + Connection: + - keep-alive + ParameterSetName: + - -g -n --tags --query-access --ingestion-access + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"c4893068-3f38-4fdb-93d4-f583177a3b83\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Fri, 24 Apr 2020 04:53:01 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n + \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n + \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": + \"Fri, 24 Apr 2020 09:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Disabled\",\r\n \"publicNetworkAccessForQuery\": + \"Disabled\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/microsoft.operationalinsights/workspaces/clitest000002\",\r\n + \ \"name\": \"clitest000002\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"clitest\": \"myron\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1072' + content-type: + - application/json + date: + - Fri, 24 Apr 2020 04:53:34 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace update + Connection: + - keep-alive + ParameterSetName: + - -g -n --query-access --ingestion-access + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"c4893068-3f38-4fdb-93d4-f583177a3b83\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Fri, 24 Apr 2020 04:53:01 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n + \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n + \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": + \"Fri, 24 Apr 2020 09:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Disabled\",\r\n \"publicNetworkAccessForQuery\": + \"Disabled\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/microsoft.operationalinsights/workspaces/clitest000002\",\r\n + \ \"name\": \"clitest000002\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"clitest\": \"myron\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1072' + content-type: + - application/json + date: + - Fri, 24 Apr 2020 04:53:38 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"tags": {"clitest": "myron"}, "location": "eastus", "properties": {"provisioningState": + "Succeeded", "sku": {"name": "pergb2018"}, "retentionInDays": 30, "publicNetworkAccessForIngestion": + "Enabled", "publicNetworkAccessForQuery": "Disabled"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace update + Connection: + - keep-alive + Content-Length: + - '244' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n --query-access --ingestion-access + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"c4893068-3f38-4fdb-93d4-f583177a3b83\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Fri, 24 Apr 2020 04:53:01 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n + \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n + \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": + \"Fri, 24 Apr 2020 09:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": + \"Disabled\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/microsoft.operationalinsights/workspaces/clitest000002\",\r\n + \ \"name\": \"clitest000002\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"clitest\": \"myron\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1071' + content-type: + - application/json + date: + - Fri, 24 Apr 2020 04:53:41 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1194' + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor log-analytics workspace show + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.3 + azure-mgmt-loganalytics/0.5.0 Azure-SDK-For-Python AZURECLI/2.4.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/Microsoft.OperationalInsights/workspaces/clitest000002?api-version=2020-03-01-preview + response: + body: + string: "{\r\n \"properties\": {\r\n \"source\": \"Azure\",\r\n \"customerId\": + \"c4893068-3f38-4fdb-93d4-f583177a3b83\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"sku\": {\r\n \"name\": \"pergb2018\",\r\n \"lastSkuUpdate\": + \"Fri, 24 Apr 2020 04:53:01 GMT\"\r\n },\r\n \"retentionInDays\": 30,\r\n + \ \"features\": {\r\n \"legacy\": 0,\r\n \"searchVersion\": 1,\r\n + \ \"enableLogAccessUsingOnlyResourcePermissions\": true\r\n },\r\n + \ \"workspaceCapping\": {\r\n \"dailyQuotaGb\": -1.0,\r\n \"quotaNextResetTime\": + \"Fri, 24 Apr 2020 09:00:00 GMT\",\r\n \"dataIngestionStatus\": \"RespectQuota\"\r\n + \ },\r\n \"publicNetworkAccessForIngestion\": \"Enabled\",\r\n \"publicNetworkAccessForQuery\": + \"Disabled\"\r\n },\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_monitor_workspace_public_access000001/providers/microsoft.operationalinsights/workspaces/clitest000002\",\r\n + \ \"name\": \"clitest000002\",\r\n \"type\": \"Microsoft.OperationalInsights/workspaces\",\r\n + \ \"location\": \"eastus\",\r\n \"tags\": {\r\n \"clitest\": \"myron\"\r\n + \ }\r\n}" + headers: + cache-control: + - no-cache + content-length: + - '1071' + content-type: + - application/json + date: + - Fri, 24 Apr 2020 04:53:43 GMT + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_log_analytics_workspace.py b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_log_analytics_workspace.py index c48f081772e..5ed5bf0ed50 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_log_analytics_workspace.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_log_analytics_workspace.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, record_only +from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, record_only, StorageAccountPreparer from azure_devtools.scenario_tests import AllowLargeResponse @@ -107,3 +107,136 @@ def test_monitor_log_analytics_workspace_linked_service_common_scenario(self): self.cmd("monitor log-analytics workspace linked-service list -g {rg} --workspace-name {workspace_name}", checks=[self.check('length(@)', 0)]) + + @ResourceGroupPreparer(name_prefix='cli_test_monitor_workspace_linked_storage', location='eastus') + @AllowLargeResponse() + @StorageAccountPreparer(name_prefix='saws1', kind='StorageV2', sku='Standard_LRS', parameter_name='account_1', location='eastus') + @StorageAccountPreparer(name_prefix='saws2', kind='StorageV2', sku='Standard_LRS', parameter_name='account_2', location='eastus') + @StorageAccountPreparer(name_prefix='saws3', kind='StorageV2', sku='Standard_LRS', parameter_name='account_3', location='eastus') + @StorageAccountPreparer(name_prefix='saws4', kind='StorageV2', sku='Standard_LRS', parameter_name='account_4', location='eastus') + def test_monitor_log_analytics_workspace_linked_storage(self, resource_group, account_1, + account_2, account_3, account_4): + from msrestazure.tools import resource_id + self.kwargs.update({ + 'name': self.create_random_name('clitest', 20), + 'name_2': self.create_random_name('clitest', 20), + 'rg': resource_group, + 'sa_1': account_1, + 'sa_2': account_2, + 'sa_3': account_3, + 'sa_4': account_4, + 'sa_id_1': resource_id( + resource_group=resource_group, + subscription=self.get_subscription_id(), + name=account_1, + namespace='Microsoft.Storage', + type='storageAccounts'), + 'sa_id_2': resource_id( + resource_group=resource_group, + subscription=self.get_subscription_id(), + name=account_2, + namespace='Microsoft.Storage', + type='storageAccounts'), + 'sa_id_3': resource_id( + resource_group=resource_group, + subscription=self.get_subscription_id(), + name=account_3, + namespace='Microsoft.Storage', + type='storageAccounts'), + 'sa_id_4': resource_id( + resource_group=resource_group, + subscription=self.get_subscription_id(), + name=account_4, + namespace='Microsoft.Storage', + type='storageAccounts'), + }) + + self.cmd("monitor log-analytics workspace create -g {rg} -n {name} --tags clitest=myron", checks=[ + self.check('provisioningState', 'Succeeded'), + self.check('retentionInDays', 30), + self.check('sku.name', 'pergb2018') + ]) + + self.cmd('monitor log-analytics workspace linked-storage create ' + '--type AzureWatson -g {rg} -n {name} --storage-accounts {sa_1}', + checks=[ + self.check('storageAccountIds[0]', '{sa_id_1}'), + self.check('name', 'azurewatson') + ]) + + self.cmd('monitor log-analytics workspace linked-storage add ' + '--type AzureWatson -g {rg} -n {name} --storage-accounts {sa_2} {sa_id_3}', + checks=[ + self.check('storageAccountIds[0]', '{sa_id_1}'), + self.check('storageAccountIds[1]', '{sa_id_2}'), + self.check('storageAccountIds[2]', '{sa_id_3}') + ]) + + self.cmd('monitor log-analytics workspace linked-storage remove ' + '--type AzureWatson -g {rg} -n {name} --storage-accounts {sa_1}', + checks=[ + self.check('storageAccountIds[0]', '{sa_id_2}'), + self.check('storageAccountIds[1]', '{sa_id_3}') + ]) + + self.cmd('monitor log-analytics workspace linked-storage show ' + '--type AzureWatson -g {rg} -n {name}', + checks=[ + self.check('storageAccountIds[0]', '{sa_id_2}'), + self.check('storageAccountIds[1]', '{sa_id_3}') + ]) + + self.cmd("monitor log-analytics workspace create -g {rg} -n {name_2} --tags clitest=myron", checks=[ + self.check('provisioningState', 'Succeeded'), + self.check('retentionInDays', 30), + self.check('sku.name', 'pergb2018') + ]) + + self.cmd('monitor log-analytics workspace linked-storage create ' + '--type CustomLogs -g {rg} -n {name} --storage-accounts {sa_1} {sa_id_4}', + checks=[ + self.check('storageAccountIds[0]', '{sa_id_1}'), + self.check('storageAccountIds[1]', '{sa_id_4}') + ]) + + self.cmd('monitor log-analytics workspace linked-storage list ' + '-g {rg} -n {name}', + checks=[ + self.check('length(@)', 2) + ]) + + self.cmd('monitor log-analytics workspace linked-storage delete ' + '--type CustomLogs -g {rg} -n {name} -y') + + self.cmd('monitor log-analytics workspace linked-storage list ' + '-g {rg} -n {name}', + checks=[ + self.check('length(@)', 1) + ]) + + @ResourceGroupPreparer(name_prefix='cli_test_monitor_workspace_public_access', location='eastus') + def test_monitor_log_analytics_workspace_public_access(self, resource_group): + from msrestazure.tools import resource_id + self.kwargs.update({ + 'name': self.create_random_name('clitest', 20), + 'name_2': self.create_random_name('clitest', 20) + }) + + self.cmd("monitor log-analytics workspace create -g {rg} -n {name} --tags clitest=myron " + "--query-access Disabled --ingestion-access Disabled", + checks=[ + self.check('publicNetworkAccessForIngestion', 'Disabled'), + self.check('publicNetworkAccessForQuery', 'Disabled') + ]) + + self.cmd("monitor log-analytics workspace update -g {rg} -n {name} " + "--query-access Disabled --ingestion-access Enabled", + checks=[ + self.check('publicNetworkAccessForIngestion', 'Enabled'), + self.check('publicNetworkAccessForQuery', 'Disabled') + ]) + + self.cmd("monitor log-analytics workspace show -g {rg} -n {name}", checks=[ + self.check('publicNetworkAccessForIngestion', 'Enabled'), + self.check('publicNetworkAccessForQuery', 'Disabled') + ]) diff --git a/src/azure-cli/azure/cli/command_modules/monitor/validators.py b/src/azure-cli/azure/cli/command_modules/monitor/validators.py index c29035b23cc..fb10980131a 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/validators.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/validators.py @@ -338,3 +338,18 @@ def validate_private_endpoint_connection_id(namespace): raise CLIError('incorrect usage. Please provide [--id ID] or [--name NAME --scope-name NAME -g NAME]') del namespace.connection_id + + +def validate_storage_accounts_name_or_id(cmd, namespace): + if namespace.storage_account_ids: + from msrestazure.tools import is_valid_resource_id, resource_id + from azure.cli.core.commands.client_factory import get_subscription_id + for index, storage_account_id in enumerate(namespace.storage_account_ids): + if not is_valid_resource_id(storage_account_id): + namespace.storage_account_ids[index] = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), + resource_group=namespace.resource_group_name, + namespace='Microsoft.Storage', + type='storageAccounts', + name=storage_account_id + )