Azure / azure-cli

Azure Command-Line Interface
MIT License
3.96k stars 2.94k forks source link

Enable Azure Defender Through ARM templates in Azure #19238

Open meenakshiyuvaraj opened 3 years ago

meenakshiyuvaraj commented 3 years ago

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

Enable Azure Defender Through ARM templates in Azure. getting error while running this template through Azure devops pipeline.

To Reproduce

Here is the template. { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "storageAccount_name": { "type": "String" } }, "variables": {}, "resources": [ { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2019-06-01", "name": "[parameters('storageAccount_name')]", "location": "[resourceGroup().location]", "tags": { "bns_appication_id": "0116" }, "sku": { "name": "Standard_GZRS", "tier": "Standard" }, "kind": "StorageV2", "properties": { "azureFilesIdentityBasedAuthentication": { "directoryServiceOptions": "None" }, "minimumTlsVersion": "TLS1_2", "allowBlobPublicAccess": false, "allowSharedKeyAccess": true, "networkAcls": { "bypass": "AzureServices", "virtualNetworkRules": [], "ipRules": [], "defaultAction": "Deny" }, "supportsHttpsTrafficOnly": true, "encryption": { "requireInfrastructureEncryption": true, "services": { "file": { "keyType": "Account", "enabled": true }, "blob": { "keyType": "Account", "enabled": true } }, "keySource": "Microsoft.Storage" }, "accessTier": "Hot" }, "resources": [ { "type": "Microsoft.Security/advancedThreatProtectionSettings", "name": "Microsoft.Security/current", "apiVersion": "2021-06-01", "dependsOn": [ "[resourceId('Microsoft.Storage/storageAccounts/', parameters('storageAccount_name'))]" ], "properties": { "isEnabled": true } } ] }, { "type": "Microsoft.Storage/storageAccounts/blobServices", "apiVersion": "2019-06-01", "name": "[concat(parameters('storageAccount_name'), '/default')]", "dependsOn": [ "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccount_name'))]" ], "sku": { "name": "Standard_GZRS", "tier": "Standard" }, "properties": { "changeFeed": { "enabled": true }, "restorePolicy": { "enabled": true, "days": 7 }, "cors": { "corsRules": [] }, "deleteRetentionPolicy": { "enabled": true, "days": 30 }, "isVersioningEnabled": true } } ] }

Expected behavior

Storage account should be created with Azure defender enabled. Environment summary

Additional context

error received:NoRegisteredProviderFound: No registered resource provider found for location 'canadacentral' and API version '2019-01-01' for type 'storageAccounts'. The supported api-versions are '2021-06-01, 2021-05-01, 2021-04-01, 2021-02-01, 2021-01-01, 2020-08-01-preview, 2019-06-01, 2019-04-01, 2018-11-01, 2018-07-01, 2018-03-01-preview, 2018-02-01, 2017-10-01, 2017-06-01, 2016-12-01, 2016-05-01, 2016-01-01, 2015-06-15, 2015-05-01-preview'. The supported locations are 'eastus, eastus2, westus, westeurope, eastasia, southeastasia, japaneast, japanwest, northcentralus, southcentralus, centralus, northeurope, brazilsouth, australiaeast, australiasoutheast, southindia, centralindia, westindia, canadaeast, canadacentral, westus2, westcentralus, uksouth, ukwest, koreacentral, koreasouth, francecentral, australiacentral, southafricanorth, uaenorth, switzerlandnorth, germanywestcentral, norwayeast, westus3, jioindiawest'.

Even after changing the Api version, it says that is not found.

yonzhan commented 3 years ago

ARM