diff --git a/src/Monitor/Monitor.Test/ScenarioTests/AzureRmDiagnosticSettingTests.cs b/src/Monitor/Monitor.Test/ScenarioTests/AzureRmDiagnosticSettingTests.cs
index 0dc9db0e733c..3ed2ff5e0373 100644
--- a/src/Monitor/Monitor.Test/ScenarioTests/AzureRmDiagnosticSettingTests.cs
+++ b/src/Monitor/Monitor.Test/ScenarioTests/AzureRmDiagnosticSettingTests.cs
@@ -84,5 +84,12 @@ public void TestSetAzureRmDiagnosticSettingLogAnalytics()
{
TestsController.NewInstance.RunPsTest(_logger, "Test-SetAzureRmDiagnosticSetting-LogAnalytics");
}
+
+ [Fact]
+ [Trait(Category.AcceptanceType, Category.CheckIn)]
+ public void TestGetAzDiagnosticSettingCategory()
+ {
+ TestsController.NewInstance.RunPsTest(_logger, "Test-GetAzDiagnosticSettingCategory");
+ }
}
}
diff --git a/src/Monitor/Monitor.Test/ScenarioTests/AzureRmDiagnosticSettingTests.ps1 b/src/Monitor/Monitor.Test/ScenarioTests/AzureRmDiagnosticSettingTests.ps1
index 3f0fb98c807c..a054574b5e09 100644
--- a/src/Monitor/Monitor.Test/ScenarioTests/AzureRmDiagnosticSettingTests.ps1
+++ b/src/Monitor/Monitor.Test/ScenarioTests/AzureRmDiagnosticSettingTests.ps1
@@ -300,7 +300,36 @@ function Test-SetAzureRmDiagnosticSetting-LogAnalytics
}
}
+<#
+.SYNOPSIS
+Test Get diagnostic setting supported categories
+#>
+function Test-GetAzDiagnosticSettingCategory
+{
+ $ResourceGroupName = 'group' + (getAssetName)
+ $SubnetConfigName = 'config' + (getAssetName)
+ $VNetName = 'vn' + (getAssetName)
+
+ try
+ {
+ $rg = New-AzResourceGroup -Name $ResourceGroupName -Location 'eastus'
+ $subnet = New-AzVirtualNetworkSubnetConfig -Name $SubnetConfigName -AddressPrefix "10.0.1.0/24"
+ $vn = New-AzVirtualNetwork -Name $VNetName -ResourceGroupName $ResourceGroupName -Location 'eastus' -AddressPrefix "10.0.0.0/16" -Subnet $subnet
+ $id = $vn.Id
+ $log = Get-AzDiagnosticSettingCategory -TargetResourceId $id -Name 'VMProtectionAlerts'
+ $metric = Get-AzDiagnosticSettingCategory -TargetResourceId $id -Name 'AllMetrics'
+
+ Assert-AreEqual 'Logs' $log.CategoryType
+ Assert-AreEqual 'Metrics' $metric.CategoryType
+
+ Remove-AzVirtualNetwork -ResourceGroupName $ResourceGroupName -Name $VNetName -Force
+ }
+ finally
+ {
+ Remove-AzResourceGroup -Name $ResourceGroupName
+ }
+}
# TODO add more complicated scenarios after we have a definitive subscription
\ No newline at end of file
diff --git a/src/Monitor/Monitor.Test/SessionRecords/Microsoft.Azure.Commands.Insights.Test.ScenarioTests.AzureRmDiagnosticSettingTests/TestGetAzDiagnosticSettingCategory.json b/src/Monitor/Monitor.Test/SessionRecords/Microsoft.Azure.Commands.Insights.Test.ScenarioTests.AzureRmDiagnosticSettingTests/TestGetAzDiagnosticSettingCategory.json
new file mode 100644
index 000000000000..8a143026364f
--- /dev/null
+++ b/src/Monitor/Monitor.Test/SessionRecords/Microsoft.Azure.Commands.Insights.Test.ScenarioTests.AzureRmDiagnosticSettingTests/TestGetAzDiagnosticSettingCategory.json
@@ -0,0 +1,1026 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourcegroups/groupps3886?api-version=2016-09-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Jlc291cmNlZ3JvdXBzL2dyb3VwcHMzODg2P2FwaS12ZXJzaW9uPTIwMTYtMDktMDE=",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"location\": \"eastus\"\r\n}",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "956425d4-a8a5-42f5-8297-bdb210168d45"
+ ],
+ "Accept-Language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient/1.3.28"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "28"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-request-id": [
+ "71d7bd5d-1da0-4c0b-8f18-d21ba77fd412"
+ ],
+ "x-ms-correlation-request-id": [
+ "71d7bd5d-1da0-4c0b-8f18-d21ba77fd412"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071517Z:71d7bd5d-1da0-4c0b-8f18-d21ba77fd412"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:16 GMT"
+ ],
+ "Content-Length": [
+ "175"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "{\r\n \"id\": \"/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886\",\r\n \"name\": \"groupps3886\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}",
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991?api-version=2020-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Jlc291cmNlR3JvdXBzL2dyb3VwcHMzODg2L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay92aXJ0dWFsTmV0d29ya3Mvdm5wczI5OTE/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "517012c9-1882-4974-b87d-f83f5008add6"
+ ],
+ "Accept-Language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Network.NetworkManagementClient/20.1.1.0"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-failure-cause": [
+ "gateway"
+ ],
+ "x-ms-request-id": [
+ "1f68826a-10a4-4326-9d7e-842e073f12fb"
+ ],
+ "x-ms-correlation-request-id": [
+ "1f68826a-10a4-4326-9d7e-842e073f12fb"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071518Z:1f68826a-10a4-4326-9d7e-842e073f12fb"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:17 GMT"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Content-Length": [
+ "225"
+ ]
+ },
+ "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceNotFound\",\r\n \"message\": \"The Resource 'Microsoft.Network/virtualNetworks/vnps2991' under resource group 'groupps3886' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix\"\r\n }\r\n}",
+ "StatusCode": 404
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991?api-version=2020-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Jlc291cmNlR3JvdXBzL2dyb3VwcHMzODg2L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay92aXJ0dWFsTmV0d29ya3Mvdm5wczI5OTE/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Network.NetworkManagementClient/20.1.1.0"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "ETag": [
+ "W/\"20eada79-0bfd-406c-9b6b-f5a5e4a5f0e9\""
+ ],
+ "x-ms-request-id": [
+ "05816435-443e-4cb6-a1b4-5e72989ad258"
+ ],
+ "x-ms-correlation-request-id": [
+ "f8a8d746-e144-4ff7-8a34-bbadc6418b7f"
+ ],
+ "x-ms-arm-service-request-id": [
+ "6630275e-d2d6-4284-a04d-284daefc95ee"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Server": [
+ "Microsoft-HTTPAPI/2.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11997"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071535Z:f8a8d746-e144-4ff7-8a34-bbadc6418b7f"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:34 GMT"
+ ],
+ "Content-Length": [
+ "1296"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "{\r\n \"name\": \"vnps2991\",\r\n \"id\": \"/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991\",\r\n \"etag\": \"W/\\\"20eada79-0bfd-406c-9b6b-f5a5e4a5f0e9\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"37078d39-3cd0-4bfb-bbb8-89d9168009d4\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"configps9784\",\r\n \"id\": \"/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991/subnets/configps9784\",\r\n \"etag\": \"W/\\\"20eada79-0bfd-406c-9b6b-f5a5e4a5f0e9\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.1.0/24\",\r\n \"serviceEndpoints\": [],\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n }\r\n ],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": false\r\n }\r\n}",
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991?api-version=2020-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Jlc291cmNlR3JvdXBzL2dyb3VwcHMzODg2L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay92aXJ0dWFsTmV0d29ya3Mvdm5wczI5OTE/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "19d20bc3-a13b-422f-be90-f509dfe04459"
+ ],
+ "Accept-Language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Network.NetworkManagementClient/20.1.1.0"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "ETag": [
+ "W/\"20eada79-0bfd-406c-9b6b-f5a5e4a5f0e9\""
+ ],
+ "x-ms-request-id": [
+ "7c8f8a7a-8a8d-4bb8-a6fd-bf40d1b76def"
+ ],
+ "x-ms-correlation-request-id": [
+ "0256f256-c10f-4168-97c8-59d1a9ad17c6"
+ ],
+ "x-ms-arm-service-request-id": [
+ "26f9e07c-c2d5-499f-a82c-94f1c63516a2"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Server": [
+ "Microsoft-HTTPAPI/2.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11996"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071535Z:0256f256-c10f-4168-97c8-59d1a9ad17c6"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:34 GMT"
+ ],
+ "Content-Length": [
+ "1296"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "{\r\n \"name\": \"vnps2991\",\r\n \"id\": \"/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991\",\r\n \"etag\": \"W/\\\"20eada79-0bfd-406c-9b6b-f5a5e4a5f0e9\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"37078d39-3cd0-4bfb-bbb8-89d9168009d4\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"configps9784\",\r\n \"id\": \"/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991/subnets/configps9784\",\r\n \"etag\": \"W/\\\"20eada79-0bfd-406c-9b6b-f5a5e4a5f0e9\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"addressPrefix\": \"10.0.1.0/24\",\r\n \"serviceEndpoints\": [],\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n }\r\n ],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": false\r\n }\r\n}",
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991?api-version=2020-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Jlc291cmNlR3JvdXBzL2dyb3VwcHMzODg2L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay92aXJ0dWFsTmV0d29ya3Mvdm5wczI5OTE/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"properties\": {\r\n \"addressPrefix\": \"10.0.1.0/24\",\r\n \"addressPrefixes\": [],\r\n \"serviceEndpoints\": [],\r\n \"serviceEndpointPolicies\": [],\r\n \"ipAllocations\": [],\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"name\": \"configps9784\"\r\n }\r\n ],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"ipAllocations\": []\r\n },\r\n \"location\": \"eastus\"\r\n}",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "bd49e151-f6e4-4aa9-ba1e-37c0f49e7917"
+ ],
+ "Accept-Language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Network.NetworkManagementClient/20.1.1.0"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "683"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Retry-After": [
+ "3"
+ ],
+ "x-ms-request-id": [
+ "87faaca5-c1cf-4cd4-8fd8-1960bca889af"
+ ],
+ "Azure-AsyncOperation": [
+ "https://management.azure.com/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/providers/Microsoft.Network/locations/eastus/operations/87faaca5-c1cf-4cd4-8fd8-1960bca889af?api-version=2020-06-01"
+ ],
+ "x-ms-correlation-request-id": [
+ "71580979-8f9f-4bfd-a02b-1efa1917cda4"
+ ],
+ "Azure-AsyncNotification": [
+ "Enabled"
+ ],
+ "x-ms-arm-service-request-id": [
+ "e6d1acd5-c71a-4b5a-8c40-e9f30121563a"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Server": [
+ "Microsoft-HTTPAPI/2.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-writes": [
+ "1199"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071530Z:71580979-8f9f-4bfd-a02b-1efa1917cda4"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:29 GMT"
+ ],
+ "Content-Length": [
+ "1294"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "{\r\n \"name\": \"vnps2991\",\r\n \"id\": \"/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991\",\r\n \"etag\": \"W/\\\"38da9187-334c-404a-8b8d-1f6548f71f97\\\"\",\r\n \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"eastus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"resourceGuid\": \"37078d39-3cd0-4bfb-bbb8-89d9168009d4\",\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"10.0.0.0/16\"\r\n ]\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"configps9784\",\r\n \"id\": \"/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991/subnets/configps9784\",\r\n \"etag\": \"W/\\\"38da9187-334c-404a-8b8d-1f6548f71f97\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"addressPrefix\": \"10.0.1.0/24\",\r\n \"serviceEndpoints\": [],\r\n \"delegations\": [],\r\n \"privateEndpointNetworkPolicies\": \"Enabled\",\r\n \"privateLinkServiceNetworkPolicies\": \"Enabled\"\r\n },\r\n \"type\": \"Microsoft.Network/virtualNetworks/subnets\"\r\n }\r\n ],\r\n \"virtualNetworkPeerings\": [],\r\n \"enableDdosProtection\": false,\r\n \"enableVmProtection\": false\r\n }\r\n}",
+ "StatusCode": 201
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/providers/Microsoft.Network/locations/eastus/operations/87faaca5-c1cf-4cd4-8fd8-1960bca889af?api-version=2020-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvZWFzdHVzL29wZXJhdGlvbnMvODdmYWFjYTUtYzFjZi00Y2Q0LThmZDgtMTk2MGJjYTg4OWFmP2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Network.NetworkManagementClient/20.1.1.0"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "18a84df3-5db1-41ee-bbb7-2d0d5fe0d24e"
+ ],
+ "x-ms-correlation-request-id": [
+ "25b70796-df7b-4fbd-96fd-ad2f7647c8e8"
+ ],
+ "x-ms-arm-service-request-id": [
+ "7c08e8be-f3f0-422b-9b3f-8218eaad66d5"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Server": [
+ "Microsoft-HTTPAPI/2.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11998"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071534Z:25b70796-df7b-4fbd-96fd-ad2f7647c8e8"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:34 GMT"
+ ],
+ "Content-Length": [
+ "29"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}",
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "//subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991/providers/microsoft.insights/diagnosticSettingsCategories/VMProtectionAlerts?api-version=2017-05-01-preview",
+ "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzU3OTQ3Y2I1LWFhZGQtNGI2Yy05ZThlLTI3ZjU0NWJiN2JmNS9yZXNvdXJjZUdyb3Vwcy9ncm91cHBzMzg4Ni9wcm92aWRlcnMvTWljcm9zb2Z0Lk5ldHdvcmsvdmlydHVhbE5ldHdvcmtzL3ZucHMyOTkxL3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvZGlhZ25vc3RpY1NldHRpbmdzQ2F0ZWdvcmllcy9WTVByb3RlY3Rpb25BbGVydHM/YXBpLXZlcnNpb249MjAxNy0wNS0wMS1wcmV2aWV3",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "4d5114b7-42a8-4fb8-9d0d-440a49a316a1"
+ ],
+ "Accept-Language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-request-id": [
+ "572e8c92-867e-452c-810d-7ce34be894a8"
+ ],
+ "Server": [
+ "Microsoft-IIS/10.0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11999"
+ ],
+ "x-ms-correlation-request-id": [
+ "326855ff-4c3b-42f2-8910-d200d2797227"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071537Z:326855ff-4c3b-42f2-8910-d200d2797227"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:37 GMT"
+ ],
+ "Content-Length": [
+ "395"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "{\r\n \"id\": \"/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourcegroups/groupps3886/providers/microsoft.network/virtualnetworks/vnps2991/providers/microsoft.insights/diagnosticSettingsCategories/VMProtectionAlerts\",\r\n \"type\": \"microsoft.insights/diagnosticSettingsCategories\",\r\n \"name\": \"VMProtectionAlerts\",\r\n \"location\": null,\r\n \"kind\": null,\r\n \"tags\": null,\r\n \"properties\": {\r\n \"categoryType\": \"Logs\"\r\n },\r\n \"identity\": null\r\n}",
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "//subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991/providers/microsoft.insights/diagnosticSettingsCategories/AllMetrics?api-version=2017-05-01-preview",
+ "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzU3OTQ3Y2I1LWFhZGQtNGI2Yy05ZThlLTI3ZjU0NWJiN2JmNS9yZXNvdXJjZUdyb3Vwcy9ncm91cHBzMzg4Ni9wcm92aWRlcnMvTWljcm9zb2Z0Lk5ldHdvcmsvdmlydHVhbE5ldHdvcmtzL3ZucHMyOTkxL3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvZGlhZ25vc3RpY1NldHRpbmdzQ2F0ZWdvcmllcy9BbGxNZXRyaWNzP2FwaS12ZXJzaW9uPTIwMTctMDUtMDEtcHJldmlldw==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "4032b5c3-9ca8-471b-9451-33265a9d2fca"
+ ],
+ "Accept-Language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Monitor.MonitorManagementClient/0.25.2.0"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-request-id": [
+ "3eb13200-cb4f-4b8f-b851-79448a76ae0e"
+ ],
+ "Server": [
+ "Microsoft-IIS/10.0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11998"
+ ],
+ "x-ms-correlation-request-id": [
+ "761570b4-36e0-491a-80d6-09db1ce4ad28"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071538Z:761570b4-36e0-491a-80d6-09db1ce4ad28"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:37 GMT"
+ ],
+ "Content-Length": [
+ "382"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "{\r\n \"id\": \"/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourcegroups/groupps3886/providers/microsoft.network/virtualnetworks/vnps2991/providers/microsoft.insights/diagnosticSettingsCategories/AllMetrics\",\r\n \"type\": \"microsoft.insights/diagnosticSettingsCategories\",\r\n \"name\": \"AllMetrics\",\r\n \"location\": null,\r\n \"kind\": null,\r\n \"tags\": null,\r\n \"properties\": {\r\n \"categoryType\": \"Metrics\"\r\n },\r\n \"identity\": null\r\n}",
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourceGroups/groupps3886/providers/Microsoft.Network/virtualNetworks/vnps2991?api-version=2020-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Jlc291cmNlR3JvdXBzL2dyb3VwcHMzODg2L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay92aXJ0dWFsTmV0d29ya3Mvdm5wczI5OTE/YXBpLXZlcnNpb249MjAyMC0wNi0wMQ==",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "e2d7e1f0-733c-470b-85af-3f0ac5bedc20"
+ ],
+ "Accept-Language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Network.NetworkManagementClient/20.1.1.0"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Location": [
+ "https://management.azure.com/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/providers/Microsoft.Network/locations/eastus/operationResults/e869e96c-378f-4005-a38d-eafd0bfe77bd?api-version=2020-06-01"
+ ],
+ "Retry-After": [
+ "10"
+ ],
+ "x-ms-request-id": [
+ "e869e96c-378f-4005-a38d-eafd0bfe77bd"
+ ],
+ "Azure-AsyncOperation": [
+ "https://management.azure.com/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/providers/Microsoft.Network/locations/eastus/operations/e869e96c-378f-4005-a38d-eafd0bfe77bd?api-version=2020-06-01"
+ ],
+ "x-ms-correlation-request-id": [
+ "0ae16fd3-67f4-45b8-9551-886a0523c056"
+ ],
+ "Azure-AsyncNotification": [
+ "Enabled"
+ ],
+ "x-ms-arm-service-request-id": [
+ "889f3c7f-dd2b-4f8d-9d52-ea320737ce28"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Server": [
+ "Microsoft-HTTPAPI/2.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-deletes": [
+ "14999"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071539Z:0ae16fd3-67f4-45b8-9551-886a0523c056"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:38 GMT"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Content-Length": [
+ "0"
+ ]
+ },
+ "ResponseBody": "",
+ "StatusCode": 202
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/providers/Microsoft.Network/locations/eastus/operations/e869e96c-378f-4005-a38d-eafd0bfe77bd?api-version=2020-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvZWFzdHVzL29wZXJhdGlvbnMvZTg2OWU5NmMtMzc4Zi00MDA1LWEzOGQtZWFmZDBiZmU3N2JkP2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Network.NetworkManagementClient/20.1.1.0"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-request-id": [
+ "463ffcb3-858b-4969-b031-738c7085e9e2"
+ ],
+ "x-ms-correlation-request-id": [
+ "67c5e298-2714-4f20-bec3-7d2bc1a39f9e"
+ ],
+ "x-ms-arm-service-request-id": [
+ "f5ad3bc8-4248-456e-8883-5845187b83f3"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Server": [
+ "Microsoft-HTTPAPI/2.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11995"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071549Z:67c5e298-2714-4f20-bec3-7d2bc1a39f9e"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:48 GMT"
+ ],
+ "Content-Length": [
+ "29"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "{\r\n \"status\": \"Succeeded\"\r\n}",
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/providers/Microsoft.Network/locations/eastus/operationResults/e869e96c-378f-4005-a38d-eafd0bfe77bd?api-version=2020-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9sb2NhdGlvbnMvZWFzdHVzL29wZXJhdGlvblJlc3VsdHMvZTg2OWU5NmMtMzc4Zi00MDA1LWEzOGQtZWFmZDBiZmU3N2JkP2FwaS12ZXJzaW9uPTIwMjAtMDYtMDE=",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Network.NetworkManagementClient/20.1.1.0"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Location": [
+ "https://management.azure.com/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/providers/Microsoft.Network/locations/eastus/operationResults/e869e96c-378f-4005-a38d-eafd0bfe77bd?api-version=2020-06-01"
+ ],
+ "x-ms-request-id": [
+ "e869e96c-378f-4005-a38d-eafd0bfe77bd"
+ ],
+ "Azure-AsyncOperation": [
+ "https://management.azure.com/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/providers/Microsoft.Network/locations/eastus/operations/e869e96c-378f-4005-a38d-eafd0bfe77bd?api-version=2020-06-01"
+ ],
+ "x-ms-correlation-request-id": [
+ "0ae16fd3-67f4-45b8-9551-886a0523c056"
+ ],
+ "Azure-AsyncNotification": [
+ "Enabled"
+ ],
+ "x-ms-arm-service-request-id": [
+ "889f3c7f-dd2b-4f8d-9d52-ea320737ce28"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "Server": [
+ "Microsoft-HTTPAPI/2.0",
+ "Microsoft-HTTPAPI/2.0"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11994"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071549Z:f7a93989-c0d9-40ec-8d1b-0455a251728f"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:49 GMT"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ]
+ },
+ "ResponseBody": "",
+ "StatusCode": 204
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/resourcegroups/groupps3886?api-version=2016-09-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L3Jlc291cmNlZ3JvdXBzL2dyb3VwcHMzODg2P2FwaS12ZXJzaW9uPTIwMTYtMDktMDE=",
+ "RequestMethod": "DELETE",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "e304667d-a4cb-4f05-b77f-2dfaca0a8d77"
+ ],
+ "Accept-Language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient/1.3.28"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Location": [
+ "https://management.azure.com/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1HUk9VUFBTMzg4Ni1FQVNUVVMiLCJqb2JMb2NhdGlvbiI6ImVhc3R1cyJ9?api-version=2016-09-01"
+ ],
+ "Retry-After": [
+ "15"
+ ],
+ "x-ms-ratelimit-remaining-subscription-deletes": [
+ "14999"
+ ],
+ "x-ms-request-id": [
+ "d3303aaa-6593-44e4-8558-52758cbe27a9"
+ ],
+ "x-ms-correlation-request-id": [
+ "d3303aaa-6593-44e4-8558-52758cbe27a9"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071554Z:d3303aaa-6593-44e4-8558-52758cbe27a9"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:15:53 GMT"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Content-Length": [
+ "0"
+ ]
+ },
+ "ResponseBody": "",
+ "StatusCode": 202
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1HUk9VUFBTMzg4Ni1FQVNUVVMiLCJqb2JMb2NhdGlvbiI6ImVhc3R1cyJ9?api-version=2016-09-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFIVWs5VlVGQlRNemc0TmkxRlFWTlVWVk1pTENKcWIySk1iMk5oZEdsdmJpSTZJbVZoYzNSMWN5Sjk/YXBpLXZlcnNpb249MjAxNi0wOS0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient/1.3.28"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Location": [
+ "https://management.azure.com/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1HUk9VUFBTMzg4Ni1FQVNUVVMiLCJqb2JMb2NhdGlvbiI6ImVhc3R1cyJ9?api-version=2016-09-01"
+ ],
+ "Retry-After": [
+ "15"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11999"
+ ],
+ "x-ms-request-id": [
+ "be52de6b-446b-4008-8d0b-57dc92f4e297"
+ ],
+ "x-ms-correlation-request-id": [
+ "be52de6b-446b-4008-8d0b-57dc92f4e297"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071609Z:be52de6b-446b-4008-8d0b-57dc92f4e297"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:16:09 GMT"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Content-Length": [
+ "0"
+ ]
+ },
+ "ResponseBody": "",
+ "StatusCode": 202
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1HUk9VUFBTMzg4Ni1FQVNUVVMiLCJqb2JMb2NhdGlvbiI6ImVhc3R1cyJ9?api-version=2016-09-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFIVWs5VlVGQlRNemc0TmkxRlFWTlVWVk1pTENKcWIySk1iMk5oZEdsdmJpSTZJbVZoYzNSMWN5Sjk/YXBpLXZlcnNpb249MjAxNi0wOS0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient/1.3.28"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Location": [
+ "https://management.azure.com/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1HUk9VUFBTMzg4Ni1FQVNUVVMiLCJqb2JMb2NhdGlvbiI6ImVhc3R1cyJ9?api-version=2016-09-01"
+ ],
+ "Retry-After": [
+ "15"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11998"
+ ],
+ "x-ms-request-id": [
+ "639920a0-d7c9-4770-90c5-622f5e15506b"
+ ],
+ "x-ms-correlation-request-id": [
+ "639920a0-d7c9-4770-90c5-622f5e15506b"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071625Z:639920a0-d7c9-4770-90c5-622f5e15506b"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:16:24 GMT"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Content-Length": [
+ "0"
+ ]
+ },
+ "ResponseBody": "",
+ "StatusCode": 202
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1HUk9VUFBTMzg4Ni1FQVNUVVMiLCJqb2JMb2NhdGlvbiI6ImVhc3R1cyJ9?api-version=2016-09-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFIVWs5VlVGQlRNemc0TmkxRlFWTlVWVk1pTENKcWIySk1iMk5oZEdsdmJpSTZJbVZoYzNSMWN5Sjk/YXBpLXZlcnNpb249MjAxNi0wOS0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient/1.3.28"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11997"
+ ],
+ "x-ms-request-id": [
+ "f5febe40-0f7e-4329-939e-3d9b64eb63c6"
+ ],
+ "x-ms-correlation-request-id": [
+ "f5febe40-0f7e-4329-939e-3d9b64eb63c6"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071640Z:f5febe40-0f7e-4329-939e-3d9b64eb63c6"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:16:40 GMT"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Content-Length": [
+ "0"
+ ]
+ },
+ "ResponseBody": "",
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/subscriptions/57947cb5-aadd-4b6c-9e8e-27f545bb7bf5/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1HUk9VUFBTMzg4Ni1FQVNUVVMiLCJqb2JMb2NhdGlvbiI6ImVhc3R1cyJ9?api-version=2016-09-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTc5NDdjYjUtYWFkZC00YjZjLTllOGUtMjdmNTQ1YmI3YmY1L29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFIVWs5VlVGQlRNemc0TmkxRlFWTlVWVk1pTENKcWIySk1iMk5oZEdsdmJpSTZJbVZoYzNSMWN5Sjk/YXBpLXZlcnNpb249MjAxNi0wOS0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.6.29321.03",
+ "OSName/Windows",
+ "OSVersion/Microsoft.Windows.10.0.19042.",
+ "Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient/1.3.28"
+ ]
+ },
+ "ResponseHeaders": {
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "11996"
+ ],
+ "x-ms-request-id": [
+ "2b10ad21-2ea6-4f90-b65b-b224dd220cc4"
+ ],
+ "x-ms-correlation-request-id": [
+ "2b10ad21-2ea6-4f90-b65b-b224dd220cc4"
+ ],
+ "x-ms-routing-request-id": [
+ "SOUTHEASTASIA:20201119T071641Z:2b10ad21-2ea6-4f90-b65b-b224dd220cc4"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Date": [
+ "Thu, 19 Nov 2020 07:16:40 GMT"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Content-Length": [
+ "0"
+ ]
+ },
+ "ResponseBody": "",
+ "StatusCode": 200
+ }
+ ],
+ "Names": {
+ "Test-GetAzDiagnosticSettingCategory": [
+ "ps3886",
+ "ps9784",
+ "ps2991"
+ ]
+ },
+ "Variables": {
+ "SubscriptionId": "57947cb5-aadd-4b6c-9e8e-27f545bb7bf5"
+ }
+}
\ No newline at end of file
diff --git a/src/Monitor/Monitor/Az.Monitor.psd1 b/src/Monitor/Monitor/Az.Monitor.psd1
index 5ca6e2c6c3b9..1d6b5b93407a 100644
--- a/src/Monitor/Monitor/Az.Monitor.psd1
+++ b/src/Monitor/Monitor/Az.Monitor.psd1
@@ -76,7 +76,10 @@ FunctionsToExport = @()
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = 'Get-AzMetricDefinition', 'Get-AzMetric', 'Remove-AzLogProfile',
'Get-AzLogProfile', 'Add-AzLogProfile', 'Get-AzActivityLog',
+ 'New-AzDiagnosticSetting',
+ 'New-AzDiagnosticDetailSetting',
'Set-AzDiagnosticSetting', 'Get-AzDiagnosticSetting',
+ 'Get-AzDiagnosticSettingCategory',
'Remove-AzDiagnosticSetting', 'New-AzAutoscaleNotification',
'New-AzAutoscaleProfile', 'New-AzAutoscaleRule',
'Add-AzAutoscaleSetting', 'Get-AzAutoscaleHistory',
diff --git a/src/Monitor/Monitor/ChangeLog.md b/src/Monitor/Monitor/ChangeLog.md
index fad3d1adb92a..2683f0d01d26 100644
--- a/src/Monitor/Monitor/ChangeLog.md
+++ b/src/Monitor/Monitor/ChangeLog.md
@@ -19,6 +19,10 @@
-->
## Upcoming Release
+* Added new cmdlets to support creating diagnostic settings more flexible:
+ * `Get-AzDiagnosticSettingCategory`
+ * `New-AzDiagnosticSetting`
+ * `New-AzDiagnosticDetailSetting`
## Version 2.2.0
* Fixed the bug that warning message cannot be suppressed. [#12889]
diff --git a/src/Monitor/Monitor/Diagnostics/GetAzureRmDiagnosticSettingCategoryCommand.cs b/src/Monitor/Monitor/Diagnostics/GetAzureRmDiagnosticSettingCategoryCommand.cs
new file mode 100644
index 000000000000..3af19b74c631
--- /dev/null
+++ b/src/Monitor/Monitor/Diagnostics/GetAzureRmDiagnosticSettingCategoryCommand.cs
@@ -0,0 +1,60 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Management.Automation;
+using Microsoft.Azure.Commands.Insights.OutputClasses;
+using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
+using Microsoft.Azure.Management.Monitor;
+using Microsoft.Azure.Management.Monitor.Models;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+
+namespace Microsoft.Azure.Commands.Insights.Diagnostics
+{
+ [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DiagnosticSettingCategory"), OutputType(typeof(PSDiagnosticSettingCategory))]
+ public class GetAzureRmDiagnosticSettingCategoryCommand : ManagementCmdletBase
+ {
+ #region Parameters declarations
+
+ [Parameter(Mandatory = true, HelpMessage = "Target resource Id")]
+ [ValidateNotNullOrEmpty]
+ public string TargetResourceId { get; set; }
+
+ [Parameter(Mandatory = false, HelpMessage = "Name of diagnostic setting category")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ #endregion
+
+ protected override void ProcessRecordInternal()
+ {
+ if (this.IsParameterBound(c => c.Name))
+ {
+ WriteObject(new PSDiagnosticSettingCategory(this.MonitorManagementClient
+ .DiagnosticSettingsCategory
+ .Get(TargetResourceId, Name)));
+ }
+ else
+ {
+ WriteObject(this.MonitorManagementClient
+ .DiagnosticSettingsCategory
+ .List(TargetResourceId)
+ .Value
+ .Select(x => new PSDiagnosticSettingCategory(x)).ToList(), true);
+ }
+ }
+ }
+}
diff --git a/src/Monitor/Monitor/Diagnostics/NewAzureRmDiagnosticDetailSettingCommand.cs b/src/Monitor/Monitor/Diagnostics/NewAzureRmDiagnosticDetailSettingCommand.cs
new file mode 100644
index 000000000000..484846ab5db3
--- /dev/null
+++ b/src/Monitor/Monitor/Diagnostics/NewAzureRmDiagnosticDetailSettingCommand.cs
@@ -0,0 +1,102 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using Microsoft.Azure.Commands.Insights.OutputClasses;
+using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
+using Microsoft.Azure.Management.Monitor;
+using Microsoft.Azure.Management.Monitor.Models;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+
+namespace Microsoft.Azure.Commands.Insights.Diagnostics
+{
+ [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DiagnosticDetailSetting", DefaultParameterSetName = MetricSettingParameterSet), OutputType(typeof(PSDiagnosticDetailSettings))]
+ public class NewAzureRmDiagnosticDetailSettingCommand : ManagementCmdletBase
+ {
+ public const string LogSettingParameterSet = "LogSettingParameterSet";
+ public const string MetricSettingParameterSet = "MetricSettingParameterSet";
+
+ #region Parameters declarations
+
+ [Parameter(ParameterSetName = LogSettingParameterSet, Mandatory = true, HelpMessage = "To create log setting")]
+ public SwitchParameter Log { get; set; }
+
+ [Parameter(ParameterSetName = MetricSettingParameterSet, Mandatory = true, HelpMessage = "To create metric setting")]
+ public SwitchParameter Metric { get; set; }
+
+ [Parameter(Mandatory = false, HelpMessage = "Retention days for retention policy")]
+ public int RetentionInDays { get; set; }
+
+ [Parameter(Mandatory = false, HelpMessage = "Enable Retention policy")]
+ public SwitchParameter RetentionEnabled { get; set; }
+
+ [Parameter(Mandatory = true, HelpMessage = "Category of setting")]
+ public string Category { get; set; }
+
+ [Parameter(Mandatory = false, HelpMessage = "Enable the setting")]
+ public SwitchParameter Enabled { get; set; }
+
+ [Parameter(ParameterSetName = MetricSettingParameterSet, Mandatory = false, HelpMessage = "TimeGrain for metric setting")]
+ public System.TimeSpan? TimeGrain { get; set; }
+
+ #endregion
+
+ protected override void ProcessRecordInternal()
+ {
+
+
+ PSRetentionPolicy policy;
+ if (!this.IsParameterBound(c => c.RetentionInDays) && !this.IsParameterBound(c => c.RetentionEnabled))
+ {
+ policy = null;
+ }
+ else
+ {
+ policy = new PSRetentionPolicy()
+ {
+ Days = this.IsParameterBound(c => c.RetentionInDays) ? this.RetentionInDays : 0,
+ Enabled = this.IsParameterBound(c => RetentionEnabled) ? true : false
+ };
+ }
+
+ PSDiagnosticDetailSettings setting;
+
+ if (this.ParameterSetName.Equals(LogSettingParameterSet))
+ {
+ setting = new PSLogSettings()
+ {
+ RetentionPolicy = policy,
+ Category = this.Category,
+ Enabled = this.IsParameterBound(c => c.Enabled) ? true : false,
+ CategoryType = PSDiagnosticSettingCategoryType.Logs
+ };
+ }
+ else
+ {
+ setting = new PSMetricSettings()
+ {
+ RetentionPolicy = policy,
+ Category = this.Category,
+ Enabled = this.IsParameterBound(c => c.Enabled) ? true : false,
+ TimeGrain = this.TimeGrain ?? default(System.TimeSpan),
+ CategoryType = PSDiagnosticSettingCategoryType.Metrics
+ };
+ }
+
+ WriteObject(setting);
+ }
+ }
+}
diff --git a/src/Monitor/Monitor/Diagnostics/NewAzureRmDiagnosticSettingCommand.cs b/src/Monitor/Monitor/Diagnostics/NewAzureRmDiagnosticSettingCommand.cs
new file mode 100644
index 000000000000..5c5a8aa154aa
--- /dev/null
+++ b/src/Monitor/Monitor/Diagnostics/NewAzureRmDiagnosticSettingCommand.cs
@@ -0,0 +1,154 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using Microsoft.Azure.Commands.Insights.OutputClasses;
+using Microsoft.Azure.Management.Monitor;
+using Microsoft.Azure.Management.Monitor.Models;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+
+namespace Microsoft.Azure.Commands.Insights.Diagnostics
+{
+ [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DiagnosticSetting"), OutputType(typeof(PSServiceDiagnosticSettings))]
+ public class NewAzureRmDiagnosticSettingCommand : ManagementCmdletBase
+ {
+ public const string StorageAccountIdParamName = "StorageAccountId";
+ public const string ServiceBusRuleIdParamName = "ServiceBusRuleId";
+ public const string EventHubNameParamName = "EventHubName";
+ public const string EventHubRuleIdParamName = "EventHubAuthorizationRuleId";
+ public const string WorkspacetIdParamName = "WorkspaceId";
+ public const string EnabledParamName = "Enabled";
+ public const string EnableLogParamName = "EnableLog";
+ public const string EnableMetricsParamName = "EnableMetrics";
+
+ #region Parameters declarations
+
+ ///
+ /// Gets or sets the resourceId parameter of the cmdlet
+ ///
+ [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource id")]
+ [ValidateNotNullOrEmpty]
+ public string TargetResourceId { get; set; }
+
+ ///
+ /// Gets or sets the resourceId parameter of the cmdlet
+ ///
+ [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the diagnostic setting. Defaults to 'service'")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; } = "service";
+
+ ///
+ /// Gets or sets the storage account parameter of the cmdlet
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The storage account id")]
+ public string StorageAccountId { get; set; }
+
+ ///
+ /// Gets or sets the service bus rule id parameter of the cmdlet
+ ///
+ [Parameter( Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The service bus rule id")]
+ public string ServiceBusRuleId { get; set; }
+
+ ///
+ /// Gets or sets the service bus rule id parameter of the cmdlet
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The service bus rule id")]
+ public string EventHubName { get; set; }
+
+ ///
+ /// Gets or sets the event hub authorization rule id parameter of the cmdlet
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The event hub rule id")]
+ public string EventHubAuthorizationRuleId { get; set; }
+
+ ///
+ /// Gets or sets the OMS workspace Id
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource Id of the Log Analytics workspace to send logs/metrics to")]
+ public string WorkspaceId { get; set; }
+
+ ///
+ /// Gets or sets the retention in days
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The value indicating whether to export (to ODS) to resource-specific (if present) or to AzureDiagnostics (default, not present)")]
+ public SwitchParameter DedicatedLogAnalyticsDestinationType { get; set; }
+
+ ///
+ /// Set list of diagnostic settings
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Metric settings or Log settings")]
+ public PSDiagnosticDetailSettings[] Setting { get; set; }
+
+ #endregion
+
+ protected override void ProcessRecordInternal()
+ {
+ Validate();
+
+ IList metrics = new List();
+ IList logs = new List();
+
+ if (this.IsParameterBound(c => c.Setting) && Setting.Length != 0)
+ {
+ foreach (PSDiagnosticDetailSettings setting in Setting)
+ {
+ switch (setting.CategoryType)
+ {
+ case PSDiagnosticSettingCategoryType.Metrics:
+ metrics.Add(((PSMetricSettings)setting).GetMetricSetting());
+ break;
+ case PSDiagnosticSettingCategoryType.Logs:
+ logs.Add(((PSLogSettings)setting).GetLogSetting());
+ break;
+ default:
+ throw new ArgumentException("Invalid diagnostic setting type");
+ }
+ }
+ }
+
+ PSServiceDiagnosticSettings DiagnosticSetting = new PSServiceDiagnosticSettings(id: this.TargetResourceId + "/diagnosticSettings/" + this.Name, name: this.Name)
+ {
+ StorageAccountId = this.IsParameterBound(c => c.StorageAccountId) ? this.StorageAccountId : null,
+ ServiceBusRuleId = this.IsParameterBound(c => c.ServiceBusRuleId) ? this.ServiceBusRuleId : null,
+ EventHubName = this.IsParameterBound(c => c.EventHubName) ? this.EventHubName : null,
+ EventHubAuthorizationRuleId = this.IsParameterBound(c => c.EventHubAuthorizationRuleId) ? this.EventHubAuthorizationRuleId : null,
+ WorkspaceId = this.IsParameterBound(c => c.WorkspaceId) ? this.WorkspaceId : null,
+ LogAnalyticsDestinationType = this.IsParameterBound(c => c.DedicatedLogAnalyticsDestinationType) ? "Dedicated" : null,
+ Metrics = metrics,
+ Logs = logs
+ };
+
+ WriteObject(DiagnosticSetting);
+ }
+
+ protected void Validate()
+ {
+ if (!this.IsParameterBound(c => c.StorageAccountId) &&
+ !this.IsParameterBound(c => c.ServiceBusRuleId) &&
+ !this.IsParameterBound(c => c.EventHubName) &&
+ !this.IsParameterBound(c => c.EventHubAuthorizationRuleId) &&
+ !this.IsParameterBound(c => c.WorkspaceId))
+ {
+ throw new ArgumentException("No operation is specified, please specify storage account Id/service bus rule Id/eventhub name/eventhub authorization rule Id/workspace Id");
+ }
+
+ if (!this.IsParameterBound(c => c.WorkspaceId) && this.IsParameterBound(c => c.DedicatedLogAnalyticsDestinationType))
+ {
+ throw new ArgumentException("Please provide workspace Id if want to use dedicated log analytics destination type");
+ }
+ }
+ }
+}
diff --git a/src/Monitor/Monitor/Monitor.format.ps1xml b/src/Monitor/Monitor/Monitor.format.ps1xml
index d113b5f447d6..338ceffbeac2 100644
--- a/src/Monitor/Monitor/Monitor.format.ps1xml
+++ b/src/Monitor/Monitor/Monitor.format.ps1xml
@@ -22,5 +22,35 @@
+
+ Microsoft.Azure.Commands.Insights.OutputClasses.PSDiagnosticSettingCategory
+
+ Microsoft.Azure.Commands.Insights.OutputClasses.PSDiagnosticSettingCategory
+
+
+
+
+
+
+
+ Id
+
+
+
+ Name
+
+
+
+ Type
+
+
+
+ CategoryType
+
+
+
+
+
+
diff --git a/src/Monitor/Monitor/OutputClasses/PSDiagnosticDetailSettings.cs b/src/Monitor/Monitor/OutputClasses/PSDiagnosticDetailSettings.cs
new file mode 100644
index 000000000000..de147c0cc534
--- /dev/null
+++ b/src/Monitor/Monitor/OutputClasses/PSDiagnosticDetailSettings.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Microsoft.Azure.Commands.Insights.OutputClasses
+{
+ public abstract class PSDiagnosticDetailSettings
+ {
+ public string Category { get; set; }
+
+ public bool Enabled { get; set; }
+
+ public PSRetentionPolicy RetentionPolicy { get; set; }
+
+ public PSDiagnosticSettingCategoryType CategoryType { get; set; }
+ }
+}
diff --git a/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategory.cs b/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategory.cs
new file mode 100644
index 000000000000..dba8b140bd58
--- /dev/null
+++ b/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategory.cs
@@ -0,0 +1,42 @@
+using Microsoft.Azure.Management.Monitor.Models;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Microsoft.Azure.Commands.Insights.OutputClasses
+{
+ public class PSDiagnosticSettingCategory
+ {
+ public string Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public string Type { get; private set; }
+
+ public PSDiagnosticSettingCategoryType? CategoryType { get; set; }
+
+ public PSDiagnosticSettingCategory() { }
+
+ public PSDiagnosticSettingCategory(DiagnosticSettingsCategoryResource category)
+ {
+ this.Id = category?.Id;
+ this.Name = category?.Name;
+ this.Type = category?.Type;
+ if (category != null)
+ {
+ switch (category.CategoryType)
+ {
+ case Microsoft.Azure.Management.Monitor.Models.CategoryType.Metrics:
+ this.CategoryType = PSDiagnosticSettingCategoryType.Metrics;
+ break;
+ case Microsoft.Azure.Management.Monitor.Models.CategoryType.Logs:
+ this.CategoryType = PSDiagnosticSettingCategoryType.Logs;
+ break;
+ default:
+ this.CategoryType = null;
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategoryType.cs b/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategoryType.cs
new file mode 100644
index 000000000000..cf71201155e1
--- /dev/null
+++ b/src/Monitor/Monitor/OutputClasses/PSDiagnosticSettingCategoryType.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Microsoft.Azure.Commands.Insights.OutputClasses
+{
+ public enum PSDiagnosticSettingCategoryType
+ {
+ Metrics,
+ Logs
+ }
+}
diff --git a/src/Monitor/Monitor/OutputClasses/PSLogSettings.cs b/src/Monitor/Monitor/OutputClasses/PSLogSettings.cs
index 716028b61d36..cfd9a7b2d1ea 100644
--- a/src/Monitor/Monitor/OutputClasses/PSLogSettings.cs
+++ b/src/Monitor/Monitor/OutputClasses/PSLogSettings.cs
@@ -20,16 +20,24 @@ namespace Microsoft.Azure.Commands.Insights.OutputClasses
///
/// Wrapps around the LogSettings
///
- public class PSLogSettings : Microsoft.Azure.Management.Monitor.Management.Models.LogSettings
+ public class PSLogSettings : PSDiagnosticDetailSettings
{
///
/// Initializes a new instance of the PSLogSettings class.
///
- public PSLogSettings(LogSettings logSettings) : base(logSettings)
+ public PSLogSettings(LogSettings logSettings)
+ {
+ if (logSettings != null)
+ {
+ this.Enabled = logSettings.Enabled;
+ this.Category = logSettings.Category;
+ this.RetentionPolicy = new PSRetentionPolicy(logSettings.RetentionPolicy);
+ }
+ this.CategoryType = PSDiagnosticSettingCategoryType.Logs;
+ }
+
+ public PSLogSettings()
{
- this.Enabled = logSettings.Enabled;
- this.Category = logSettings.Category;
- this.RetentionPolicy = new Management.Monitor.Management.Models.RetentionPolicy(logSettings.RetentionPolicy);
}
///
@@ -45,5 +53,15 @@ public override string ToString()
output.Append("RetentionPolicy : " + RetentionPolicy.ToString(1));
return output.ToString();
}
+
+ public LogSettings GetLogSetting()
+ {
+ return new LogSettings()
+ {
+ Enabled = this.Enabled,
+ Category = this.Category,
+ RetentionPolicy = this.RetentionPolicy
+ };
+ }
}
}
diff --git a/src/Monitor/Monitor/OutputClasses/PSMetricSettings.cs b/src/Monitor/Monitor/OutputClasses/PSMetricSettings.cs
index 5bb25a88bf8b..5b7d56d02cfe 100644
--- a/src/Monitor/Monitor/OutputClasses/PSMetricSettings.cs
+++ b/src/Monitor/Monitor/OutputClasses/PSMetricSettings.cs
@@ -21,15 +21,29 @@ namespace Microsoft.Azure.Commands.Insights.OutputClasses
///
/// Wrapps around the MetricSettings
///
- public class PSMetricSettings : Management.Monitor.Management.Models.MetricSettings
+ public class PSMetricSettings : PSDiagnosticDetailSettings
{
///
/// Initializes a new instance of the PSMetricSettings class.
///
- public PSMetricSettings(MetricSettings metricSettings) : base(metricSettings)
+ public PSMetricSettings(MetricSettings metricSettings)
{
+ if (metricSettings != null)
+ {
+ this.Category = metricSettings.Category;
+ this.Enabled = metricSettings.Enabled;
+ this.RetentionPolicy = new PSRetentionPolicy(metricSettings.RetentionPolicy);
+ this.TimeGrain = metricSettings.TimeGrain ?? default(System.TimeSpan);
+ }
+ this.CategoryType = PSDiagnosticSettingCategoryType.Metrics;
}
+ public PSMetricSettings()
+ {
+ }
+
+ public System.TimeSpan TimeGrain { get; set; }
+
///
/// A string representation of the PSMetricSettings
///
@@ -40,9 +54,20 @@ public override string ToString()
output.AppendLine();
output.AppendLine("Category : " + Category);
output.AppendLine("Enabled : " + Enabled);
- output.AppendLine("TimeGrain : " + XmlConvert.ToString(TimeGrain));
+ output.AppendLine("TimeGrain : " + XmlConvert.ToString((System.TimeSpan)TimeGrain));
output.Append("RetentionPolicy : " + RetentionPolicy.ToString(1));
return output.ToString();
}
+
+ public MetricSettings GetMetricSetting()
+ {
+ return new MetricSettings()
+ {
+ Enabled = this.Enabled,
+ Category = this.Category,
+ RetentionPolicy = this.RetentionPolicy,
+ TimeGrain = this.TimeGrain
+ };
+ }
}
}
diff --git a/src/Monitor/Monitor/OutputClasses/PSRetentionPolicy.cs b/src/Monitor/Monitor/OutputClasses/PSRetentionPolicy.cs
index 74d6b86e9890..4193f060285e 100644
--- a/src/Monitor/Monitor/OutputClasses/PSRetentionPolicy.cs
+++ b/src/Monitor/Monitor/OutputClasses/PSRetentionPolicy.cs
@@ -21,6 +21,10 @@ namespace Microsoft.Azure.Commands.Insights.OutputClasses
///
public class PSRetentionPolicy : Microsoft.Azure.Management.Monitor.Management.Models.RetentionPolicy
{
+ public PSRetentionPolicy()
+ {
+ }
+
///
/// Initializes a new instance of the PSRetention class
///
diff --git a/src/Monitor/Monitor/OutputClasses/PSServiceDiagnosticSettings.cs b/src/Monitor/Monitor/OutputClasses/PSServiceDiagnosticSettings.cs
index e6395025dc02..2e7805913417 100644
--- a/src/Monitor/Monitor/OutputClasses/PSServiceDiagnosticSettings.cs
+++ b/src/Monitor/Monitor/OutputClasses/PSServiceDiagnosticSettings.cs
@@ -32,18 +32,15 @@ public class PSServiceDiagnosticSettings : DiagnosticSettingsResource
///
public IDictionary Tags { get; set; }
- ///
- /// Sets or gets the Logs of the Diagnostic Setting.
- /// This property in transitional until the namesace change is taken
- ///
- public new IList Logs { get; set; }
+ //public new string Id { get; set; }
- ///
- /// Sets or gets the Logs of the Diagnostic Setting.
- /// This property in transitional until the namesace change is taken
- ///
- public new IList Metrics { get; set; }
+ //public new string Name { get; set; } = "service";
+ public PSServiceDiagnosticSettings() { }
+
+ public PSServiceDiagnosticSettings(string id = default(string), string name = default(string)) : base(id, name)
+ {
+ }
///
/// Initializes a new instance of the PSServiceDiagnosticSettings class.
@@ -65,19 +62,19 @@ public PSServiceDiagnosticSettings(DiagnosticSettingsResource serviceDiagnosticS
if (serviceDiagnosticSettings.Metrics != null)
{
- this.Metrics = new List();
+ this.Metrics = new List();
foreach (MetricSettings metricSettings in serviceDiagnosticSettings.Metrics)
{
- this.Metrics.Add(new PSMetricSettings(metricSettings));
+ this.Metrics.Add(metricSettings);
}
}
if (serviceDiagnosticSettings.Logs != null)
{
- this.Logs = new List();
+ this.Logs = new List();
foreach (LogSettings logSettings in serviceDiagnosticSettings.Logs)
{
- this.Logs.Add(new PSLogSettings(logSettings));
+ this.Logs.Add(logSettings);
}
}
diff --git a/src/Monitor/Monitor/TransitionalClasses/RetentionPolicy.cs b/src/Monitor/Monitor/TransitionalClasses/RetentionPolicy.cs
index e468c7132033..8f1e3b5c0a34 100644
--- a/src/Monitor/Monitor/TransitionalClasses/RetentionPolicy.cs
+++ b/src/Monitor/Monitor/TransitionalClasses/RetentionPolicy.cs
@@ -36,6 +36,10 @@ public RetentionPolicy(Monitor.Models.RetentionPolicy retentionPolicy)
}
}
+ public RetentionPolicy()
+ {
+ }
+
///
/// A string representation of the PSRetentionPolicy
///
diff --git a/src/Monitor/Monitor/help/Az.Monitor.md b/src/Monitor/Monitor/help/Az.Monitor.md
index 7eb82fd191d2..6bf521be611e 100644
--- a/src/Monitor/Monitor/help/Az.Monitor.md
+++ b/src/Monitor/Monitor/help/Az.Monitor.md
@@ -56,6 +56,9 @@ Gets Autoscale settings.
### [Get-AzDiagnosticSetting](Get-AzDiagnosticSetting.md)
Gets the logged categories and time grains.
+### [Get-AzDiagnosticSettingCategory](Get-AzDiagnosticSettingCategory.md)
+Get or list supported diagnostic setting category for Azure resource.
+
### [Get-AzInsightsPrivateLinkScope](Get-AzInsightsPrivateLinkScope.md)
Get private link scope
@@ -104,6 +107,12 @@ Creates an Autoscale rule.
### [New-AzAutoscaleWebhook](New-AzAutoscaleWebhook.md)
Creates an Autoscale webhook.
+### [New-AzDiagnosticDetailSetting](New-AzDiagnosticDetailSetting.md)
+Create PSDiagnosticDetailSetting Object, type could be metric or log
+
+### [New-AzDiagnosticSetting](New-AzDiagnosticSetting.md)
+Create PSServiceDiagnosticSettings object.
+
### [New-AzInsightsPrivateLinkScope](New-AzInsightsPrivateLinkScope.md)
create private link scope
diff --git a/src/Monitor/Monitor/help/Get-AzDiagnosticSettingCategory.md b/src/Monitor/Monitor/help/Get-AzDiagnosticSettingCategory.md
new file mode 100644
index 000000000000..eba867a8cb7f
--- /dev/null
+++ b/src/Monitor/Monitor/help/Get-AzDiagnosticSettingCategory.md
@@ -0,0 +1,101 @@
+---
+external help file: Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll-Help.xml
+Module Name: Az.Monitor
+online version: https://docs.microsoft.com/en-us/powershell/module/az.monitor/get-azdiagnosticsettingcategory
+schema: 2.0.0
+---
+
+# Get-AzDiagnosticSettingCategory
+
+## SYNOPSIS
+Get or list supported diagnostic setting category for Azure resource.
+
+## SYNTAX
+
+```
+Get-AzDiagnosticSettingCategory -TargetResourceId [-Name ]
+ [-DefaultProfile ] []
+```
+
+## DESCRIPTION
+Get or list supported diagnostic setting category for Azure resource.
+
+## EXAMPLES
+
+### Example 1
+```powershell
+PS C:\> Get-AzDiagnosticSetting -TargetResourceId -TargetResourceId /subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXX/providers/Microsoft.Network/virtualNetworks/XXXXXXXX
+Id : /subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXX/providers/Microsoft.Network/virtualNetworks/XXXXXXXX/providers/microsoft.insights/diagnosticSettingsCategories/VMProtectionAlerts
+Name : VMProtectionAlerts
+Type : microsoft.insights/diagnosticSettingsCategories
+CategoryType : Logs
+
+Id : /subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXX/providers/Microsoft.Network/virtualNetworks/XXXXXXXX/providers/microsoft.insights/diagnosticSettingsCategories/AllMetrics
+Name : AllMetrics
+Type : microsoft.insights/diagnosticSettingsCategories
+CategoryType : Metrics
+```
+
+Get supported diagnostic setting categories for virtual network.
+
+## PARAMETERS
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
+Parameter Sets: (All)
+Aliases: AzContext, AzureRmContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Name
+Name of diagnostic setting category
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TargetResourceId
+Target resource Id
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### System.String
+
+## OUTPUTS
+
+### Microsoft.Azure.Commands.Insights.OutputClasses.PSDiagnosticSettingCategory
+
+## NOTES
+
+## RELATED LINKS
diff --git a/src/Monitor/Monitor/help/New-AzDiagnosticDetailSetting.md b/src/Monitor/Monitor/help/New-AzDiagnosticDetailSetting.md
new file mode 100644
index 000000000000..0788b1eb0384
--- /dev/null
+++ b/src/Monitor/Monitor/help/New-AzDiagnosticDetailSetting.md
@@ -0,0 +1,193 @@
+---
+external help file: Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll-Help.xml
+Module Name: Az.Monitor
+online version: https://docs.microsoft.com/en-us/powershell/module/az.monitor/new-azdiagnosticdetailsetting
+schema: 2.0.0
+---
+
+# New-AzDiagnosticDetailSetting
+
+## SYNOPSIS
+Create PSDiagnosticDetailSetting Object, type could be metric or log
+
+## SYNTAX
+
+### LogSettingParameterSet
+```
+New-AzDiagnosticDetailSetting -Log [-RetentionInDays ] [-RetentionEnabled] -Category
+ [-Enabled] [-DefaultProfile ] []
+```
+
+### MetricSettingParameterSet
+```
+New-AzDiagnosticDetailSetting -Metric [-RetentionInDays ] [-RetentionEnabled] -Category
+ [-Enabled] [-TimeGrain ] [-DefaultProfile ] []
+```
+
+## DESCRIPTION
+Create PSMetricSettings or PSLogSettings object.
+You can get categories by using `Get-AzDiagnosticSettingCategory`.
+
+## EXAMPLES
+
+### Example 1
+```powershell
+PS C:\> $TimeGrain=New-TimeSpan -Days 90
+PS C:\> New-AzDiagnosticDetailSetting -Metric -RetentionInDays 1 -RetentionEnabled -Category AllMetrics -Enabled -TimeGrain $TimeGrain
+TimeGrain : 90.00:00:00
+Category : AllMetrics
+Enabled : True
+RetentionPolicy :
+ Enabled : True
+ Days : 1
+CategoryType : Metrics
+```
+
+Create PSMetricSettings object.
+
+### Example 2
+```powershell
+PS C:\> New-AzDiagnosticDetailSetting -Log -RetentionInDays 1 -RetentionEnabled -Category Audit -Enabled
+Category Enabled RetentionPolicy CategoryType
+-------- ------- --------------- ------------
+Audit True … Logs
+```
+
+Create PSLogSettings object.
+
+## PARAMETERS
+
+### -Category
+Category of setting
+
+```yaml
+Type: System.String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
+Parameter Sets: (All)
+Aliases: AzContext, AzureRmContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Enabled
+Enable the setting
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Log
+To create log setting
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: LogSettingParameterSet
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Metric
+To create metric setting
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: MetricSettingParameterSet
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -RetentionEnabled
+Enable Retention policy
+
+```yaml
+Type: System.Management.Automation.SwitchParameter
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -RetentionInDays
+Retention days for retention policy
+
+```yaml
+Type: System.Int32
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -TimeGrain
+TimeGrain for metric setting
+
+```yaml
+Type: System.Nullable`1[System.TimeSpan]
+Parameter Sets: MetricSettingParameterSet
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### System.String
+
+## OUTPUTS
+
+### Microsoft.Azure.Commands.Insights.OutputClasses.PSDiagnosticDetailSettings
+
+## NOTES
+
+## RELATED LINKS
diff --git a/src/Monitor/Monitor/help/New-AzDiagnosticSetting.md b/src/Monitor/Monitor/help/New-AzDiagnosticSetting.md
new file mode 100644
index 000000000000..5e135bcf8e9b
--- /dev/null
+++ b/src/Monitor/Monitor/help/New-AzDiagnosticSetting.md
@@ -0,0 +1,240 @@
+---
+external help file: Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll-Help.xml
+Module Name: Az.Monitor
+online version: https://docs.microsoft.com/en-us/powershell/module/az.monitor/new-azdiagnosticsetting
+schema: 2.0.0
+---
+
+# New-AzDiagnosticSetting
+
+## SYNOPSIS
+Create PSServiceDiagnosticSettings object.
+
+## SYNTAX
+
+```
+New-AzDiagnosticSetting -TargetResourceId -Name [-StorageAccountId ]
+ [-ServiceBusRuleId ] [-EventHubName ] [-EventHubAuthorizationRuleId ]
+ [-WorkspaceId ] [-DedicatedLogAnalyticsDestinationType] [-Setting ]
+ [-DefaultProfile ] []
+```
+
+## DESCRIPTION
+Create PSServiceDiagnosticSettings object.
+This can be used as parameter `-InputObject`
+for
+`Set-AzDiagnosticSetting`
+
+## EXAMPLES
+
+### Example 1
+```powershell
+$TimeGrain=New-TimeSpan -Days 90
+$metric = New-AzDiagnosticDetailSetting -Metric -RetentionInDays 1 -RetentionEnabled -Category AllMetrics
+$log = New-AzDiagnosticDetailSetting -Log -RetentionInDays 1 -RetentionEnabled -Category Audit -Enabled
+$setting = New-AzDiagnosticSetting -TargetResourceId /subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXX/providers/Microsoft.Network/virtualNetworks/XXXXXXXX -Name diagnostic-test -WorkspaceId /subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXX/providers/Microsoft.OperationalInsights/workspaces/XXXXXXXXX -DedicatedLogAnalyticsDestinationType -Setting $log,$metric
+Location :
+Tags :
+Id : /subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXX/providers/Microsoft.Network/virtualNetworks/XXXXXXXX/diagnosticSettings/diagnostic-test
+Name : diagnostic-test
+StorageAccountId :
+ServiceBusRuleId :
+EventHubAuthorizationRuleId :
+EventHubName :
+Metrics
+ TimeGrain :
+ Category : AllMetrics
+ Enabled : False
+ RetentionPolicy
+ Enabled : True
+ Days : 1
+
+
+Logs
+ Category : Audit
+ Enabled : True
+ RetentionPolicy
+ Enabled : True
+ Days : 1
+
+
+WorkspaceId : /subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXX/providers/Microsoft.OperationalInsights/workspaces/XXXXXXXXX
+LogAnalyticsDestinationType : Dedicated
+Type :
+
+Set-AzDiagnosticSetting -InputObject $setting
+```
+
+Create PSServiceDiagnosticSettings object. And create diagnostic setting for target resource.
+
+## PARAMETERS
+
+### -DedicatedLogAnalyticsDestinationType
+The value indicating whether to export (to ODS) to resource-specific (if present) or to AzureDiagnostics (default, not present)
+
+```yaml
+Type: SwitchParameter
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### -DefaultProfile
+The credentials, account, tenant, and subscription used for communication with Azure.
+
+```yaml
+Type: IAzureContextContainer
+Parameter Sets: (All)
+Aliases: AzContext, AzureRmContext, AzureCredential
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -EventHubAuthorizationRuleId
+The event hub rule id
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### -EventHubName
+The service bus rule id
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### -Name
+The name of the diagnostic setting.
+Defaults to 'service'
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### -ServiceBusRuleId
+The service bus rule id
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### -Setting
+Metric settings or Log settings
+
+```yaml
+Type: PSDiagnosticDetailSettings[]
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### -StorageAccountId
+The storage account id
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### -TargetResourceId
+The resource id
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### -WorkspaceId
+The resource Id of the Log Analytics workspace to send logs/metrics to
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### System.String
+
+### System.Management.Automation.SwitchParameter
+
+### Microsoft.Azure.Commands.Insights.OutputClasses.PSDiagnosticDetailSettings[]
+
+## OUTPUTS
+
+### Microsoft.Azure.Commands.Insights.OutputClasses.PSServiceDiagnosticSettings
+
+## NOTES
+
+## RELATED LINKS
diff --git a/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssues.csv
new file mode 100644
index 000000000000..c138f735c8c7
--- /dev/null
+++ b/tools/StaticAnalysis/Exceptions/Az.Monitor/BreakingChangeIssues.csv
@@ -0,0 +1,7 @@
+"AssemblyFileName","ClassName","Target","Severity","ProblemId","Description","Remediation"
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.GetAzureRmDiagnosticSettingCommand","Get-AzDiagnosticSetting","0","3030","The generic type for 'property Logs' has been changed from 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.LogSettings]' to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Models.LogSettings]'. ","Change the generic type for 'property Logs' back to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.LogSettings]'."
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.GetAzureRmDiagnosticSettingCommand","Get-AzDiagnosticSetting","0","3030","The generic type for 'property Metrics' has been changed from 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.MetricSettings]' to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Models.MetricSettings]'. ","Change the generic type for 'property Metrics' back to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.MetricSettings]'."
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.SetAzureRmDiagnosticSettingCommand","Set-AzDiagnosticSetting","0","3030","The generic type for 'property Logs' has been changed from 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.LogSettings]' to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Models.LogSettings]'. ","Change the generic type for 'property Logs' back to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.LogSettings]'."
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.SetAzureRmDiagnosticSettingCommand","Set-AzDiagnosticSetting","0","3030","The generic type for 'property Metrics' has been changed from 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.MetricSettings]' to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Models.MetricSettings]'. ","Change the generic type for 'property Metrics' back to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.MetricSettings]'."
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.SetAzureRmDiagnosticSettingCommand","Set-AzDiagnosticSetting","0","3030","The generic type for 'property Logs' has been changed from 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.LogSettings]' to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Models.LogSettings]'. ","Change the generic type for 'property Logs' back to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.LogSettings]'."
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.SetAzureRmDiagnosticSettingCommand","Set-AzDiagnosticSetting","0","3030","The generic type for 'property Metrics' has been changed from 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.MetricSettings]' to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Models.MetricSettings]'. ","Change the generic type for 'property Metrics' back to 'System.Collections.Generic.IList`1[Microsoft.Azure.Management.Monitor.Management.Models.MetricSettings]'."
\ No newline at end of file
diff --git a/tools/StaticAnalysis/Exceptions/Az.Monitor/SignatureIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Monitor/SignatureIssues.csv
index 31c081f3f5c0..bcbed4ea1e8a 100644
--- a/tools/StaticAnalysis/Exceptions/Az.Monitor/SignatureIssues.csv
+++ b/tools/StaticAnalysis/Exceptions/Az.Monitor/SignatureIssues.csv
@@ -10,4 +10,7 @@
"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.ScheduledQueryRules.NewScheduledQueryRuleTriggerConditionCommand","New-AzScheduledQueryRuleTriggerCondition","1","8100","New-AzScheduledQueryRuleTriggerCondition Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"
"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.PrivateLinkScopes.NewAzureInsightsPrivateLinkScope","New-AzInsightsPrivateLinkScope","1","8410","Parameter Tags of cmdlet New-AzInsightsPrivateLinkScope does not follow the enforced naming convention of using a singular noun for a parameter name.","Consider using a singular noun for the parameter name."
"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.PrivateLinkScopes.UpdateAzureInsightsPrivateLinkScope","Update-AzInsightsPrivateLinkScope","1","8410","Parameter Tags of cmdlet Update-AzInsightsPrivateLinkScope does not follow the enforced naming convention of using a singular noun for a parameter name.","Consider using a singular noun for the parameter name."
-"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.SetAzureRmDiagnosticSettingCommand","Set-AzDiagnosticSetting","1","8410","Parameter EnableMetrics of cmdlet Set-AzDiagnosticSetting does not follow the enforced naming convention of using a singular noun for a parameter name.","Consider using a singular noun for the parameter name."
\ No newline at end of file
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.SetAzureRmDiagnosticSettingCommand","Set-AzDiagnosticSetting","1","8410","Parameter EnableMetrics of cmdlet Set-AzDiagnosticSetting does not follow the enforced naming convention of using a singular noun for a parameter name.","Consider using a singular noun for the parameter name."
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.NewAzureRmDiagnosticDetailSettingCommand","New-AzDiagnosticDetailSetting","1","8100","New-AzDiagnosticDetailSetting Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.NewAzureRmDiagnosticDetailSettingCommand","New-AzDiagnosticDetailSetting","1","8510","Cmdlet 'New-AzDiagnosticDetailSetting' has multiple parameter sets, but no defined default parameter set.","Define a default parameter set in the cmdlet attribute."
+"Microsoft.Azure.PowerShell.Cmdlets.Monitor.dll","Microsoft.Azure.Commands.Insights.Diagnostics.NewAzureRmDiagnosticSettingCommand","New-AzDiagnosticSetting","1","8100","New-AzDiagnosticSetting Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue"
\ No newline at end of file