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 885a58e6c43..e13e313947c 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 @@ -27,6 +27,10 @@ def cf_diagnostics(cli_ctx, _): return cf_monitor(cli_ctx, _).diagnostic_settings +def cf_diagnostics_category(cli_ctx, _): + return cf_monitor(cli_ctx, _).diagnostic_settings_category + + def cf_log_profiles(cli_ctx, _): return cf_monitor(cli_ctx, _).log_profiles 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 31cfdca1523..94891907481 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/commands.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/commands.py @@ -12,7 +12,7 @@ def load_command_table(self, _): from ._client_factory import ( cf_alert_rules, cf_metric_def, cf_alert_rule_incidents, cf_log_profiles, cf_autoscale, cf_diagnostics, cf_activity_log, cf_action_groups, cf_activity_log_alerts, cf_event_categories, - cf_metric_alerts, cf_log_analytics_workspace) + cf_metric_alerts, cf_log_analytics_workspace, cf_diagnostics_category) from ._exception_handler import monitor_exception_handler, missing_resource_handler from .transformers import (action_group_list_table) from .validators import process_autoscale_create_namespace @@ -83,7 +83,7 @@ def load_command_table(self, _): diagnostics_categories_sdk = CliCommandType( operations_tmpl='azure.mgmt.monitor.operations#DiagnosticSettingsCategoryOperations.{}', - client_factory=cf_diagnostics, + client_factory=cf_diagnostics_category, operation_group='diagnostic_settings_category', exception_handler=monitor_exception_handler) diff --git a/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_diagnostic_settings_scenario.yaml b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_diagnostic_settings_scenario.yaml index f9994528f1d..7f7080e2935 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_diagnostic_settings_scenario.yaml +++ b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_diagnostic_settings_scenario.yaml @@ -13,15 +13,15 @@ interactions: ParameterSetName: - -n -g User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-resource/4.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-resource/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.81 accept-language: - en-US method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001?api-version=2019-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","type":"Microsoft.Resources/resourceGroups","location":"southcentralus","tags":{"product":"azurecli","cause":"automation","date":"2019-10-21T11:27:43Z"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001","name":"clitest.rg000001","type":"Microsoft.Resources/resourceGroups","location":"southcentralus","tags":{"product":"azurecli","cause":"automation","date":"2020-02-03T06:06:34Z"},"properties":{"provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -30,7 +30,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 11:28:17 GMT + - Mon, 03 Feb 2020 06:07:17 GMT expires: - '-1' pragma: @@ -62,8 +62,8 @@ interactions: ParameterSetName: - -n -g User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-network/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-network/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.81 accept-language: - en-US method: PUT @@ -71,13 +71,13 @@ interactions: response: body: string: "{\r\n \"name\": \"nsg000003\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003\",\r\n - \ \"etag\": \"W/\\\"1debe635-777a-4dce-b2c7-759744bdf228\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"7027edb5-eca2-4fe0-8b22-16108d511abe\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": - \"27762885-e1eb-4378-80be-1f639adfbc60\",\r\n \"securityRules\": [],\r\n + \"b1994d53-2604-438d-9b8c-bd1d81d0253e\",\r\n \"securityRules\": [],\r\n \ \"defaultSecurityRules\": [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/AllowVnetInBound\",\r\n - \ \"etag\": \"W/\\\"1debe635-777a-4dce-b2c7-759744bdf228\\\"\",\r\n + \ \"etag\": \"W/\\\"7027edb5-eca2-4fe0-8b22-16108d511abe\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \ \"description\": \"Allow inbound traffic from all VMs in VNET\",\r\n @@ -89,7 +89,7 @@ interactions: [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/AllowAzureLoadBalancerInBound\",\r\n - \ \"etag\": \"W/\\\"1debe635-777a-4dce-b2c7-759744bdf228\\\"\",\r\n + \ \"etag\": \"W/\\\"7027edb5-eca2-4fe0-8b22-16108d511abe\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \ \"description\": \"Allow inbound traffic from azure load balancer\",\r\n @@ -101,7 +101,7 @@ interactions: [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllInBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/DenyAllInBound\",\r\n - \ \"etag\": \"W/\\\"1debe635-777a-4dce-b2c7-759744bdf228\\\"\",\r\n + \ \"etag\": \"W/\\\"7027edb5-eca2-4fe0-8b22-16108d511abe\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \ \"description\": \"Deny all inbound traffic\",\r\n \"protocol\": @@ -112,7 +112,7 @@ interactions: \ \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n \ {\r\n \"name\": \"AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/AllowVnetOutBound\",\r\n - \ \"etag\": \"W/\\\"1debe635-777a-4dce-b2c7-759744bdf228\\\"\",\r\n + \ \"etag\": \"W/\\\"7027edb5-eca2-4fe0-8b22-16108d511abe\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \ \"description\": \"Allow outbound traffic from all VMs to all VMs @@ -124,7 +124,7 @@ interactions: [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/AllowInternetOutBound\",\r\n - \ \"etag\": \"W/\\\"1debe635-777a-4dce-b2c7-759744bdf228\\\"\",\r\n + \ \"etag\": \"W/\\\"7027edb5-eca2-4fe0-8b22-16108d511abe\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \ \"description\": \"Allow outbound traffic from all VMs to Internet\",\r\n @@ -136,7 +136,7 @@ interactions: [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllOutBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/DenyAllOutBound\",\r\n - \ \"etag\": \"W/\\\"1debe635-777a-4dce-b2c7-759744bdf228\\\"\",\r\n + \ \"etag\": \"W/\\\"7027edb5-eca2-4fe0-8b22-16108d511abe\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \ \"description\": \"Deny all outbound traffic\",\r\n \"protocol\": @@ -149,7 +149,7 @@ interactions: \ ]\r\n }\r\n}" headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/8688e5d6-76cd-4f88-8036-b96fcd53ce51?api-version=2019-09-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/e8bb9843-4e01-412d-95f1-a5033ec4b522?api-version=2019-09-01 cache-control: - no-cache content-length: @@ -157,7 +157,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 11:28:21 GMT + - Mon, 03 Feb 2020 06:07:28 GMT expires: - '-1' pragma: @@ -170,9 +170,9 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - e6247541-41ce-4a93-9bcb-70e1428cadf2 + - 5aa35f8c-8714-4da5-980a-e52f7a599d0e x-ms-ratelimit-remaining-subscription-writes: - - '1167' + - '1199' status: code: 201 message: Created @@ -190,10 +190,10 @@ interactions: ParameterSetName: - -n -g User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-network/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-network/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.81 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/8688e5d6-76cd-4f88-8036-b96fcd53ce51?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/southcentralus/operations/e8bb9843-4e01-412d-95f1-a5033ec4b522?api-version=2019-09-01 response: body: string: "{\r\n \"status\": \"Succeeded\"\r\n}" @@ -205,7 +205,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 11:28:26 GMT + - Mon, 03 Feb 2020 06:07:33 GMT expires: - '-1' pragma: @@ -222,7 +222,7 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - 18ef6a8b-bfbc-4272-b29b-9bb2f6a2c219 + - 6d964fbd-9a33-4761-be3a-48e98b925b18 status: code: 200 message: OK @@ -240,20 +240,20 @@ interactions: ParameterSetName: - -n -g User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-network/6.0.0 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-network/7.0.0 Azure-SDK-For-Python AZURECLI/2.0.81 method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003?api-version=2019-09-01 response: body: string: "{\r\n \"name\": \"nsg000003\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003\",\r\n - \ \"etag\": \"W/\\\"9a39d175-f940-42a9-a7ba-cd9a63e1abc9\\\"\",\r\n \"type\": + \ \"etag\": \"W/\\\"06a3083c-ff85-4bf7-adb3-0451bf46a590\\\"\",\r\n \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\": \"southcentralus\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": - \"27762885-e1eb-4378-80be-1f639adfbc60\",\r\n \"securityRules\": [],\r\n + \"b1994d53-2604-438d-9b8c-bd1d81d0253e\",\r\n \"securityRules\": [],\r\n \ \"defaultSecurityRules\": [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/AllowVnetInBound\",\r\n - \ \"etag\": \"W/\\\"9a39d175-f940-42a9-a7ba-cd9a63e1abc9\\\"\",\r\n + \ \"etag\": \"W/\\\"06a3083c-ff85-4bf7-adb3-0451bf46a590\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"description\": \"Allow inbound traffic from all VMs in VNET\",\r\n @@ -265,7 +265,7 @@ interactions: [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/AllowAzureLoadBalancerInBound\",\r\n - \ \"etag\": \"W/\\\"9a39d175-f940-42a9-a7ba-cd9a63e1abc9\\\"\",\r\n + \ \"etag\": \"W/\\\"06a3083c-ff85-4bf7-adb3-0451bf46a590\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"description\": \"Allow inbound traffic from azure load balancer\",\r\n @@ -277,7 +277,7 @@ interactions: [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllInBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/DenyAllInBound\",\r\n - \ \"etag\": \"W/\\\"9a39d175-f940-42a9-a7ba-cd9a63e1abc9\\\"\",\r\n + \ \"etag\": \"W/\\\"06a3083c-ff85-4bf7-adb3-0451bf46a590\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"description\": \"Deny all inbound traffic\",\r\n \"protocol\": @@ -288,7 +288,7 @@ interactions: \ \"destinationPortRanges\": [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n \ {\r\n \"name\": \"AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/AllowVnetOutBound\",\r\n - \ \"etag\": \"W/\\\"9a39d175-f940-42a9-a7ba-cd9a63e1abc9\\\"\",\r\n + \ \"etag\": \"W/\\\"06a3083c-ff85-4bf7-adb3-0451bf46a590\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"description\": \"Allow outbound traffic from all VMs to all VMs @@ -300,7 +300,7 @@ interactions: [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"AllowInternetOutBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/AllowInternetOutBound\",\r\n - \ \"etag\": \"W/\\\"9a39d175-f940-42a9-a7ba-cd9a63e1abc9\\\"\",\r\n + \ \"etag\": \"W/\\\"06a3083c-ff85-4bf7-adb3-0451bf46a590\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"description\": \"Allow outbound traffic from all VMs to Internet\",\r\n @@ -312,7 +312,7 @@ interactions: [],\r\n \"sourceAddressPrefixes\": [],\r\n \"destinationAddressPrefixes\": []\r\n }\r\n },\r\n {\r\n \"name\": \"DenyAllOutBound\",\r\n \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/defaultSecurityRules/DenyAllOutBound\",\r\n - \ \"etag\": \"W/\\\"9a39d175-f940-42a9-a7ba-cd9a63e1abc9\\\"\",\r\n + \ \"etag\": \"W/\\\"06a3083c-ff85-4bf7-adb3-0451bf46a590\\\"\",\r\n \ \"type\": \"Microsoft.Network/networkSecurityGroups/defaultSecurityRules\",\r\n \ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"description\": \"Deny all outbound traffic\",\r\n \"protocol\": @@ -331,9 +331,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 11:28:26 GMT + - Mon, 03 Feb 2020 06:07:33 GMT etag: - - W/"9a39d175-f940-42a9-a7ba-cd9a63e1abc9" + - W/"06a3083c-ff85-4bf7-adb3-0451bf46a590" expires: - '-1' pragma: @@ -350,7 +350,56 @@ interactions: x-content-type-options: - nosniff x-ms-arm-service-request-id: - - ec5d5f73-a89f-43c8-a36a-537effd080c9 + - 8d882122-e258-4db1-9189-8eb5e1ce1652 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - monitor diagnostic-settings categories list + Connection: + - keep-alive + ParameterSetName: + - -g --resource-type --resource + User-Agent: + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-monitor/0.7.0 Azure-SDK-For-Python AZURECLI/2.0.81 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Network/networkSecurityGroups/nsg000003/providers/microsoft.insights/diagnosticSettingsCategories?api-version=2017-05-01-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001/providers/microsoft.network/networksecuritygroups/nsg000003/providers/microsoft.insights/diagnosticSettingsCategories/NetworkSecurityGroupEvent","type":"microsoft.insights/diagnosticSettingsCategories","name":"NetworkSecurityGroupEvent","location":null,"kind":null,"tags":null,"properties":{"categoryType":"Logs"},"identity":null},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest.rg000001/providers/microsoft.network/networksecuritygroups/nsg000003/providers/microsoft.insights/diagnosticSettingsCategories/NetworkSecurityGroupRuleCounter","type":"microsoft.insights/diagnosticSettingsCategories","name":"NetworkSecurityGroupRuleCounter","location":null,"kind":null,"tags":null,"properties":{"categoryType":"Logs"},"identity":null}]}' + headers: + cache-control: + - no-cache + content-length: + - '999' + content-type: + - application/json; charset=utf-8 + date: + - Mon, 03 Feb 2020 06:07:36 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff status: code: 200 message: OK @@ -375,8 +424,8 @@ interactions: ParameterSetName: - -n --resource --resource-type --resource-group --storage-account --log -o User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-monitor/0.5.2 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-monitor/0.7.0 Azure-SDK-For-Python AZURECLI/2.0.81 accept-language: - en-US method: PUT @@ -392,7 +441,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 11:28:33 GMT + - Mon, 03 Feb 2020 06:07:42 GMT expires: - '-1' pragma: @@ -423,13 +472,11 @@ interactions: - monitor diagnostic-settings list Connection: - keep-alive - Content-Type: - - application/json; charset=utf-8 ParameterSetName: - --resource --resource-type --resource-group -o User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-monitor/0.5.2 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-monitor/0.7.0 Azure-SDK-For-Python AZURECLI/2.0.81 accept-language: - en-US method: GET @@ -445,7 +492,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 11:28:35 GMT + - Mon, 03 Feb 2020 06:07:47 GMT expires: - '-1' pragma: @@ -474,13 +521,11 @@ interactions: - monitor diagnostic-settings show Connection: - keep-alive - Content-Type: - - application/json; charset=utf-8 ParameterSetName: - -n --resource --resource-type --resource-group -o User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-monitor/0.5.2 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-monitor/0.7.0 Azure-SDK-For-Python AZURECLI/2.0.81 accept-language: - en-US method: GET @@ -496,7 +541,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 11:28:38 GMT + - Mon, 03 Feb 2020 06:07:52 GMT expires: - '-1' pragma: @@ -527,13 +572,11 @@ interactions: - keep-alive Content-Length: - '0' - Content-Type: - - application/json; charset=utf-8 ParameterSetName: - -n --resource --resource-type --resource-group -o User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-monitor/0.5.2 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-monitor/0.7.0 Azure-SDK-For-Python AZURECLI/2.0.81 accept-language: - en-US method: DELETE @@ -547,7 +590,7 @@ interactions: content-length: - '0' date: - - Mon, 21 Oct 2019 11:28:45 GMT + - Mon, 03 Feb 2020 06:07:58 GMT expires: - '-1' pragma: @@ -559,7 +602,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14991' + - '14999' status: code: 200 message: OK @@ -574,13 +617,11 @@ interactions: - monitor diagnostic-settings list Connection: - keep-alive - Content-Type: - - application/json; charset=utf-8 ParameterSetName: - --resource --resource-type --resource-group -o User-Agent: - - python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 - azure-mgmt-monitor/0.5.2 Azure-SDK-For-Python AZURECLI/2.0.75 + - python/3.8.0 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2 + azure-mgmt-monitor/0.7.0 Azure-SDK-For-Python AZURECLI/2.0.81 accept-language: - en-US method: GET @@ -596,7 +637,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 21 Oct 2019 11:28:48 GMT + - Mon, 03 Feb 2020 06:08:00 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_diagnostic_settings.py b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_diagnostic_settings.py index 4d6541454b5..51f27b9a8ad 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_diagnostic_settings.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_diagnostic_settings.py @@ -17,6 +17,10 @@ def test_monitor_diagnostic_settings_scenario(self, resource_group, storage_acco }) self.cmd('network nsg create -n {nsg} -g {rg}') + self.cmd('monitor diagnostic-settings categories list -g {rg} --resource-type Microsoft.Network/networkSecurityGroups --resource {nsg}', checks=[ + self.check('length(value)', 2) + ]) + self.kwargs['log_config'] = json.dumps([ { "category": "NetworkSecurityGroupEvent",