question

FrankSchullerer-2686 avatar image
0 Votes"
FrankSchullerer-2686 asked FrankSchullerer-2686 answered

Create/assign an existing Azure Blueprint sample via Terraform

Hi,

I want to create an Azure blueprint with Terraform. In Azure, you can select an existing blueprint (sample, see screenshot) e.g. ISO 27001 or Australian Government ISM PROTECTED. I have found this documentation: blueprint_assignment but I don’t know if it can also be used to select an existing sample by name (e.g. ISO 27001). So far my attempts have been unsuccessful.
Can someone help me there?



131654-blueprint.png


azure-blueprints
blueprint.png (75.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FrankSchullerer-2686 avatar image
0 Votes"
FrankSchullerer-2686 answered

After a lot of trial and error, I found a pretty good solution.
It may not be perfect, since I use an ARM template with Terraform, but it works.
In the following example an ISO 27001 policy is added directly to the current Azure subscription.




 resource "azurerm_subscription_template_deployment" "terraform-iso" {
   name                = "terraform-iso-1"
   location         = "West Europe"
    
   template_content = <<TEMPLATE
 {
     "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
     "contentVersion": "1.0.0.0",
     "parameters": {},
     "resources": [
         {
             "type": "Microsoft.Authorization/policyAssignments",
             "name": "MyIso27001",
             "apiVersion": "2021-06-01",
             "properties": {
                 "scope": "[subscription().id]",
                 "policyDefinitionId": "/providers/Microsoft.Authorization/policySetDefinitions/89c6cddc-1c73-4ac1-b19c-54d1a15a42f2",
                 "parameters": {}
             }, 
             "location": "westeurope",
             "identity": {
                 "type": "SystemAssigned"
               }
    
         }
     ]
 }
   TEMPLATE
      
 }

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FrankSchullerer-2686 avatar image
1 Vote"
FrankSchullerer-2686 answered SwathiDhanwada-MSFT commented

It is not possible yet. Please see 10082


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@FrankSchullerer-2686 Thanks for sharing this information for the benefit of broader community.

0 Votes 0 ·