Error deploying storage account diagnostic setting using ARM template

Anonymous
2022-05-04T22:59:14.68+00:00

Hi,
I'm trying to deploy diagnostic settings for Azure storage using ARM templates following https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/resource-manager-diagnostic-settings#diagnostic-setting-for-azure-storage.
Following is the snippet of the resource block:

{  
"type": "Microsoft.Storage/storageAccounts/blobServices/providers/diagnosticsettings",  
                            "apiVersion": "2017-05-01-preview",  
                            "name": "[concat(parameters('storageAccountName'),'/default/Microsoft.Insights/', parameters('settingName'))]",  
                            "properties": {  
                                "storageAccountId": "[parameters('archiveStorageId')]",  
                                "logs": [  
                                    {  
                                        "category": "StorageRead",  
                                        "enabled": true  
                                    },  
                                    {  
                                        "category": "StorageWrite",  
                                        "enabled": true  
                                    },  
                                    {  
                                        "category": "StorageDelete",  
                                        "enabled": true  
                                    }  
                                ]  
 }  

However, I'm getting the following error for all storage types:

The resource type could not be found in the namespace 'Microsoft.Storage' for api version '2017-05-01-preview'  
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,490 questions
{count} votes

1 answer

Sort by: Most helpful
  1. shiva patpi 13,366 Reputation points Microsoft Employee Moderator
    2022-05-07T06:21:03.23+00:00

    Hello @Anonymous ,
    I just tried the exact same template mentioned at https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/resource-manager-diagnostic-settings#diagnostic-setting-for-azure-storage.
    and it went through successfully.

    Please find the attached template & Parameters file

    [199767-enablestoragediag.txt]
    Command used:
    az group deployment create -g resourcegroupname --template-file .\enablestoragediag.json --parameters .\parameters.json

    199854-image.png

    199878-parameters.txt

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.