Create/assign an existing Azure Blueprint sample via Terraform

Frank Schullerer 141 Reputation points
2021-09-13T15:58:04.347+00:00

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
Azure Blueprints
An Azure service that provides templates for quick, repeatable creation of fully governed cloud subscriptions.
70 questions
0 comments No comments
{count} votes

Accepted answer
  1. Frank Schullerer 141 Reputation points
    2021-09-15T11:35:42.223+00:00

    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
    
    }
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Frank Schullerer 141 Reputation points
    2021-09-14T12:54:45.117+00:00

    It is not possible yet. Please see 10082

    1 person found this answer helpful.