Search code examples
azure-blob-storageazure-storageazure-automationazure-bicep

Azure BICEP storage blob child resource failing deployment


I have following BICEP code

param location string = 'canadacentral'

resource storageaccount 'Microsoft.Storage/storageAccounts@2021-02-01' = {
  name: 'btestb1278ba'
  location: location
  kind: 'StorageV2'
  sku: {
    name: 'Standard_LRS'
  }
  properties: {
    supportsHttpsTrafficOnly: true
  }
}



resource blob2 'Microsoft.Storage/storageAccounts/blobServices@2021-09-01' = {
  name: 'default'
  parent: storageaccount
  
}

I get the following error

ERROR: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/XXXX-XXXX-XXXXXX/resourceGroups/appA/providers/Microsoft.Resources/deployments/storResourceDeploy","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"HttpResourceNotFound","message":"The request url https://management.azure.com/subscriptions/XXXX-XXXX-XXXXXX/resourcegroups/appA/providers/Microsoft.Storage/storageAccounts/btestb12789/blobServices/blobz?api-version=2021-02-01 is not found."}]}}

On the portal in rg deployments I see the following error { "code": "DeploymentFailed", "target": "/subscriptions/XXXXXX/resourceGroups/appA/providers/Microsoft.Resources/deployments/storResourceDeploy", "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.", "details": [ { "code": "HttpResourceNotFound", "message": "The request url https://management.azure.com/subscriptions/XXXXXX/resourcegroups/appA/providers/Microsoft.Storage/storageAccounts/btestb12789/blobServices/blobz?api-version=2021-02-01 is not found." } ] }

Not sure what is the reason, its not suppose to find the resource, rather create it, any suggestion will be helpful. Thanks


Solution

  • I found the problem, the problem was not the above code, however the code below it, I didnt post it earlier because I didnt realize it was the one troubling.

    resource storageaccount 'Microsoft.Storage/storageAccounts@2021-02-01' = {
      name: 'btestb1278ba'
      location: location
      kind: 'StorageV2'
      sku: {
        name: 'Standard_LRS'
      }
      properties: {
        supportsHttpsTrafficOnly: true
      }
    }
    
    
    
    resource blob2 'Microsoft.Storage/storageAccounts/blobServices@2021-09-01' = {
      name: 'default'
      parent: storageaccount
      
    }
    
    resource cont 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-02-01' = {
      name: 'sepcont'
      parent: blob2
    
        
    }
    
    
    
    
    
    resource storageaccount2 'Microsoft.Storage/storageAccounts@2021-02-01' = {
      name: 'btestb12789'
      location: location
      kind: 'StorageV2'
      sku: {
        name: 'Standard_LRS'
      }
      properties: {
        supportsHttpsTrafficOnly: true
      }
    
      resource blob1 'blobServices' = {
        name: 'blob'
        
      }
    }
    

    Precisely the following is not allowed, value of the blob service should be set to default only, it cant have any othername.

      resource blob1 'blobServices' = {
        name: 'blob'
        
      }
    

    Once I changed the name to default, it worked. Thank you all.