From da84943e95900e61518c595432d510de28a23ccd Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 29 Aug 2022 13:44:55 -0700 Subject: [PATCH 1/9] Add custom assignment snippet --- ...nage Custom Profile Assignment.snippet.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json diff --git a/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json b/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json new file mode 100644 index 000000000..7eb72a91e --- /dev/null +++ b/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "prefix": "arm-automanage-custom-assignment", + "description": "Create a Custom Automanage Configuration Profile Assignment" + }, + "resources": [ + { + "type": "Microsoft.Compute/virtualMachines/providers/configurationProfileAssignments", + "apiVersion": "2022-05-04", + "name": "[concat('${1:vmName}', '/Microsoft.Automanage/default')]", + "properties": { + "configurationProfile": "/subscriptions/${2:subscriptionId}/resourceGroups/${3:resourceGroup}/providers/Microsoft.Automanage/configurationProfiles/${4:profileName}" + } + } + ] +} From a6ab3b6880d83c7735bcd24d878e303a231d2697 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 29 Aug 2022 13:46:14 -0700 Subject: [PATCH 2/9] Add custom profile snippet --- ...omanage Create Custom Profile.snippet.json | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 assets/resourceSnippets/Automanage Create Custom Profile.snippet.json diff --git a/assets/resourceSnippets/Automanage Create Custom Profile.snippet.json b/assets/resourceSnippets/Automanage Create Custom Profile.snippet.json new file mode 100644 index 000000000..97e43e163 --- /dev/null +++ b/assets/resourceSnippets/Automanage Create Custom Profile.snippet.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "prefix": "arm-automanage-custom-profile", + "description": "Create a Custom Automanage Configuration Profile" + }, + "resources": [ + { + "name": "${1:automanage}", + "type": "Microsoft.Automanage/configurationProfiles", + "apiVersion": "2022-05-04", + "location": "[resourceGroup().location]", + "properties": { + "configuration": { + "Antimalware/Enable": true, + "Antimalware/Exclusions/Paths": "", + "Antimalware/Exclusions/Extensions": "", + "Antimalware/Exclusions/Processes": "", + "Antimalware/EnableRealTimeProtection": true, + "Antimalware/RunScheduledScan": true, + "Antimalware/ScanType": "Quick", + "Antimalware/ScanDay": 7, + "Antimalware/ScanTimeInMinutes": 120, + "Backup/Enable": true, + "Backup/PolicyName": "dailyBackupPolicy", + "Backup/TimeZone": "UTC", + "Backup/InstantRpRetentionRangeInDays": 2, + "Backup/SchedulePolicy/ScheduleRunFrequency": "Daily", + "Backup/SchedulePolicy/SchedulePolicyType": "SimpleSchedulePolicy", + "Backup/RetentionPolicy/RetentionPolicyType": "LongTermRetentionPolicy", + "Backup/RetentionPolicy/DailySchedule/RetentionDuration/Count": 180, + "Backup/RetentionPolicy/DailySchedule/RetentionDuration/DurationType": "Days", + "WindowsAdminCenter/Enable": false, + "VMInsights/Enable": true, + "AzureSecurityCenter/Enable": true, + "UpdateManagement/Enable": true, + "ChangeTrackingAndInventory/Enable": true, + "GuestConfiguration/Enable": true, + "AutomationAccount/Enable": true, + "LogAnalytics/Enable": true, + "BootDiagnostics/Enable": true + } + } + } + ] +} From 6afc9a6b3d96c8ce7e4c8fd4cebe25ef4b27dae1 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 29 Aug 2022 13:47:08 -0700 Subject: [PATCH 3/9] Add best practices prod assignment snippet --- ...Best Practices Prod Assignment.snippet.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json diff --git a/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json b/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json new file mode 100644 index 000000000..792457743 --- /dev/null +++ b/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "prefix": "arm-automanage-best-practices-prod-assignment", + "description": "Create a Best Practices Production Configuration Profile Assignment" + }, + "resources": [ + { + "type": "Microsoft.Compute/virtualMachines/providers/configurationProfileAssignments", + "apiVersion": "2022-05-04", + "name": "[concat('${1:vmName}', '/Microsoft.Automanage/default')]", + "properties": { + "configurationProfile": "/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesProduction" + } + } + ] +} From 500a7b63b664fc3d9a2838ecca807314cef9586a Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 29 Aug 2022 13:47:53 -0700 Subject: [PATCH 4/9] Add best practices devtest assignment snippet --- ...t Practices DevTest Assignment.snippet.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json diff --git a/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json b/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json new file mode 100644 index 000000000..d44df2c86 --- /dev/null +++ b/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "prefix": "arm-automanage-best-practices-devtest-assignment", + "description": "Create a Best Practices DevTest Configuration Profile Assignment" + }, + "resources": [ + { + "type": "Microsoft.Compute/virtualMachines/providers/configurationProfileAssignments", + "apiVersion": "2022-05-04", + "name": "[concat('${1:vmName}', '/Microsoft.Automanage/default')]", + "properties": { + "configurationProfile": "/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest" + } + } + ] +} From e1b3ab1659a190ac525d2460b1064e2fd6bf81ab Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 13 Sep 2022 13:15:14 -0700 Subject: [PATCH 5/9] Ignore schema validation for automanage --- test/functional/snippets.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/functional/snippets.test.ts b/test/functional/snippets.test.ts index 6686643aa..bf060d68c 100644 --- a/test/functional/snippets.test.ts +++ b/test/functional/snippets.test.ts @@ -265,6 +265,12 @@ const overrideIgnoreSchemaValidation: { [name: string]: boolean } = { + 'Missing required property "protectedSettings"' */ "Linux VM Custom Script": true, + + // TODO: Remove when schemas are published + "Automanage Best Practices DevTest Assignment": true, + "Automanage Best Practices Prod Assignment": true, + "Automanage Create Custom Profile": true, + "Automanage Custom Profile Assignment": true, }; suite("Snippets functional tests", () => { From 5c361c780e1a88135a7409924be821a5c5625a4c Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 13 Sep 2022 13:34:22 -0700 Subject: [PATCH 6/9] Shorten prefix --- .../Automanage Best Practices DevTest Assignment.snippet.json | 2 +- .../Automanage Best Practices Prod Assignment.snippet.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json b/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json index d44df2c86..d33ab78e2 100644 --- a/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json +++ b/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json @@ -2,7 +2,7 @@ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { - "prefix": "arm-automanage-best-practices-devtest-assignment", + "prefix": "arm-automanage-bp-devtest-assignment", "description": "Create a Best Practices DevTest Configuration Profile Assignment" }, "resources": [ diff --git a/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json b/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json index 792457743..ec3939e4b 100644 --- a/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json +++ b/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json @@ -2,7 +2,7 @@ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { - "prefix": "arm-automanage-best-practices-prod-assignment", + "prefix": "arm-automanage-bp-prod-assignment", "description": "Create a Best Practices Production Configuration Profile Assignment" }, "resources": [ From 6f8af7583427df3ad2ad3b4d1f85e4b924ca541e Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 13 Sep 2022 14:37:28 -0700 Subject: [PATCH 7/9] Change configurationProfile value to use resourceId --- .../Automanage Custom Profile Assignment.snippet.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json b/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json index 7eb72a91e..3686752ef 100644 --- a/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json +++ b/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json @@ -6,12 +6,12 @@ "description": "Create a Custom Automanage Configuration Profile Assignment" }, "resources": [ - { + { "type": "Microsoft.Compute/virtualMachines/providers/configurationProfileAssignments", "apiVersion": "2022-05-04", "name": "[concat('${1:vmName}', '/Microsoft.Automanage/default')]", "properties": { - "configurationProfile": "/subscriptions/${2:subscriptionId}/resourceGroups/${3:resourceGroup}/providers/Microsoft.Automanage/configurationProfiles/${4:profileName}" + "configurationProfile": "[resourceId('Microsoft.Automanage/configurationProfiles', '${2:configurationProfileName}')]" } } ] From 6ed68e591450ceee13f547d5ee4be3e4b6b6fb2b Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 13 Sep 2022 14:59:15 -0700 Subject: [PATCH 8/9] Add scope property --- ...Automanage Best Practices DevTest Assignment.snippet.json | 5 +++-- .../Automanage Best Practices Prod Assignment.snippet.json | 5 +++-- .../Automanage Custom Profile Assignment.snippet.json | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json b/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json index d33ab78e2..6acaf8549 100644 --- a/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json +++ b/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json @@ -7,9 +7,10 @@ }, "resources": [ { - "type": "Microsoft.Compute/virtualMachines/providers/configurationProfileAssignments", + "type": "Microsoft.Automanage/configurationProfileAssignments", + "scope": "'Microsoft.Compute/virtualMachines/${1:vmName}", "apiVersion": "2022-05-04", - "name": "[concat('${1:vmName}', '/Microsoft.Automanage/default')]", + "name": "default", "properties": { "configurationProfile": "/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesDevTest" } diff --git a/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json b/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json index ec3939e4b..1b858f58d 100644 --- a/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json +++ b/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json @@ -7,9 +7,10 @@ }, "resources": [ { - "type": "Microsoft.Compute/virtualMachines/providers/configurationProfileAssignments", + "type": "Microsoft.Automanage/configurationProfileAssignments", + "scope": "'Microsoft.Compute/virtualMachines/${1:vmName}", "apiVersion": "2022-05-04", - "name": "[concat('${1:vmName}', '/Microsoft.Automanage/default')]", + "name": "default", "properties": { "configurationProfile": "/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesProduction" } diff --git a/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json b/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json index 3686752ef..9b685ba86 100644 --- a/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json +++ b/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json @@ -7,9 +7,10 @@ }, "resources": [ { - "type": "Microsoft.Compute/virtualMachines/providers/configurationProfileAssignments", + "type": "Microsoft.Automanage/configurationProfileAssignments", + "scope": "'Microsoft.Compute/virtualMachines/${1:vmName}", "apiVersion": "2022-05-04", - "name": "[concat('${1:vmName}', '/Microsoft.Automanage/default')]", + "name": "default", "properties": { "configurationProfile": "[resourceId('Microsoft.Automanage/configurationProfiles', '${2:configurationProfileName}')]" } From 240ca1f1207b79ee76714400343e0cfa9fda9cfd Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 14 Sep 2022 09:35:10 -0700 Subject: [PATCH 9/9] Move 'scope' property above 'type' --- .../Automanage Best Practices DevTest Assignment.snippet.json | 2 +- .../Automanage Best Practices Prod Assignment.snippet.json | 2 +- .../Automanage Custom Profile Assignment.snippet.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json b/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json index 6acaf8549..047c4e97d 100644 --- a/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json +++ b/assets/resourceSnippets/Automanage Best Practices DevTest Assignment.snippet.json @@ -7,8 +7,8 @@ }, "resources": [ { - "type": "Microsoft.Automanage/configurationProfileAssignments", "scope": "'Microsoft.Compute/virtualMachines/${1:vmName}", + "type": "Microsoft.Automanage/configurationProfileAssignments", "apiVersion": "2022-05-04", "name": "default", "properties": { diff --git a/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json b/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json index 1b858f58d..3017aa910 100644 --- a/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json +++ b/assets/resourceSnippets/Automanage Best Practices Prod Assignment.snippet.json @@ -7,8 +7,8 @@ }, "resources": [ { - "type": "Microsoft.Automanage/configurationProfileAssignments", "scope": "'Microsoft.Compute/virtualMachines/${1:vmName}", + "type": "Microsoft.Automanage/configurationProfileAssignments", "apiVersion": "2022-05-04", "name": "default", "properties": { diff --git a/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json b/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json index 9b685ba86..239594202 100644 --- a/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json +++ b/assets/resourceSnippets/Automanage Custom Profile Assignment.snippet.json @@ -7,8 +7,8 @@ }, "resources": [ { - "type": "Microsoft.Automanage/configurationProfileAssignments", "scope": "'Microsoft.Compute/virtualMachines/${1:vmName}", + "type": "Microsoft.Automanage/configurationProfileAssignments", "apiVersion": "2022-05-04", "name": "default", "properties": {