Search code examples
azureazure-rm-templateazure-security

Azure security center enabling auto provision with ARM template does not work


I am trying to enable the auto provision for Azure security center with ARM template. My template has this as resource:

    {
        "type": "Microsoft.Security/autoProvisioningSettings",
        "name": "default",
        "apiVersion": "2017-08-01-preview",
        "properties":{
            "autoProvision": "On"
        }
    }

However, this does not seem to work. I can use powershell to set it but I would like to have everything in ARM. Am I doing something wrong or how can I get the autoprovision set to on?


Solution

  • The template should be correct, I suppose it may be related to the way to deploy the template, I deploy it via the powershell, it works fine on my side.

    My complete template auto.json:

    {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {},
        "resources": [
            {
                "type": "Microsoft.Security/autoProvisioningSettings",
                "name": "default",
                "apiVersion": "2017-08-01-preview",
                "properties": {
                    "autoProvision": "On"
                }
            }
        ]
    }
    

    My powershell to deploy the template:

    New-AzDeployment -Location "central us" -TemplateFile "C:\Users\joyw\Desktop\auto.json"
    

    Test result(note the change of the autoProvision):

    enter image description here