From d949c4b58fdd8dae5491d03209299ff80177267c Mon Sep 17 00:00:00 2001 From: MyronFanQiu Date: Thu, 3 Sep 2020 10:16:58 +0800 Subject: [PATCH 1/3] refine error message --- .../azure/cli/command_modules/monitor/_exception_handler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/monitor/_exception_handler.py b/src/azure-cli/azure/cli/command_modules/monitor/_exception_handler.py index f79f98c4a36..d775fd43db0 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/_exception_handler.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/_exception_handler.py @@ -13,6 +13,7 @@ def monitor_exception_handler(ex): from azure.mgmt.monitor.v2018_01_01.models import ErrorResponseException as ErrorResponseException_v2018_01_01 from azure.mgmt.monitor.v2018_03_01.models import ErrorResponseException as ErrorResponseException_v2018_03_01 from azure.mgmt.monitor.v2019_06_01.models import ErrorResponseException as ErrorResponseException_v2019_06_01 + from msrestazure.azure_exceptions import CloudError from knack.util import CLIError @@ -22,7 +23,8 @@ def monitor_exception_handler(ex): ErrorResponseException_v2017_05_01, ErrorResponseException_v2018_01_01, ErrorResponseException_v2018_03_01, - ErrorResponseException_v2019_06_01 + ErrorResponseException_v2019_06_01, + CloudError )): # work around for issue: https://github.com/Azure/azure-sdk-for-python/issues/1556 try: From 9ed33e016d31750e7a2846f11ccb1d502050754b Mon Sep 17 00:00:00 2001 From: MyronFanQiu Date: Thu, 3 Sep 2020 10:26:30 +0800 Subject: [PATCH 2/3] refine example --- src/azure-cli/azure/cli/command_modules/monitor/_help.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 426b11af8cb..2c774aef1f7 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/_help.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/_help.py @@ -1221,7 +1221,7 @@ 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 + - name: Create two linked storage accounts for a log analytics workspace using the name of the storage account. text: az monitor log-analytics workspace linked-storage create --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts SA1 SA2 """ @@ -1237,7 +1237,7 @@ 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 + - name: Add two linked storage accounts for a log analytics workspace using the name of the storage account. text: az monitor log-analytics workspace linked-storage add --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts SA1 SA2 """ @@ -1245,7 +1245,7 @@ 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 + - name: Remove two linked storage accounts for a log analytics workspace using the name of the storage account. text: az monitor log-analytics workspace linked-storage remove --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts SA1 SA2. """ From ecdb05188bfeb0cca1b4a9bcebf289324cbd8c1c Mon Sep 17 00:00:00 2001 From: MyronFanQiu Date: Wed, 9 Sep 2020 14:18:41 +0800 Subject: [PATCH 3/3] address comments --- .../azure/cli/command_modules/monitor/_help.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 2c774aef1f7..18cfb60f650 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/_help.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/_help.py @@ -1222,7 +1222,9 @@ short-summary: Create some linked storage accounts for log analytics workspace. examples: - name: Create two linked storage accounts for a log analytics workspace using the name of the storage account. - text: az monitor log-analytics workspace linked-storage create --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts SA1 SA2 + text: az monitor log-analytics workspace linked-storage create --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts StorageAccount1 StorageAccount2 + - name: Create one linked storage accounts for a log analytics workspace using the resource id of the storage account. + text: az monitor log-analytics workspace linked-storage create --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/cli000001 """ helps['monitor log-analytics workspace linked-storage delete'] = """ @@ -1238,7 +1240,9 @@ 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 using the name of the storage account. - text: az monitor log-analytics workspace linked-storage add --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts SA1 SA2 + text: az monitor log-analytics workspace linked-storage add --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts StorageAccount1 StorageAccount2 + - name: Add one linked storage accounts for a log analytics workspace using the resource id of the storage account. + text: az monitor log-analytics workspace linked-storage add --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/cli000001 """ helps['monitor log-analytics workspace linked-storage remove'] = """ @@ -1246,7 +1250,9 @@ 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 using the name of the storage account. - text: az monitor log-analytics workspace linked-storage remove --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts SA1 SA2. + text: az monitor log-analytics workspace linked-storage remove --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts StorageAccount1 StorageAccount2 + - name: Remove one linked storage accounts for a log analytics workspace using the resource id of the storage account. + text: az monitor log-analytics workspace linked-storage remove --type AzureWatson -g MyResourceGroup --workspace-name MyWorkspace --storage-accounts /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/cli000001 """ helps['monitor log-analytics workspace linked-storage list'] = """