Kamsiinov
Kamsiinov

Reputation: 1490

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?

Upvotes: 1

Views: 504

Answers (2)

deepak
deepak

Reputation: 131

I tried the same template with latest version of az cli i.e. 2.0.60 on Mac
command: az deployment create --location WestUS --template-file deploy.json

and it worked. Verified by following command: az security auto-provisioning-setting show -n "default"

I think the Powershell module version in your host might not have the support for autoProvision property. UPGRADE Powershell module by following command :

Update-Module -Name Az

And, re-try the deployment by this powershell command:

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

Upvotes: -1

Joy Wang
Joy Wang

Reputation: 42123

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

Upvotes: 2

Related Questions