Azure BICEP 存储 Blob 子资源部署失败。

huangapple go评论63阅读模式
英文:

Azure BICEP storage blob child resource failing deployment

问题

我有以下的BICEP代码

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
}

我收到了以下错误

错误: {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions/XXXX-XXXX-XXXXXX/resourceGroups/appA/providers/Microsoft.Resources/deployments/storResourceDeploy","message":"至少有一个资源部署操作失败。请列出详细的部署操作。请参阅 https://aka.ms/arm-deployment-operations 以获取使用详细信息。","details":[{"code":"HttpResourceNotFound","message":"请求网址 https://management.azure.com/subscriptions/XXXX-XXXX-XXXXXX/resourcegroups/appA/providers/Microsoft.Storage/storageAccounts/btestb12789/blobServices/blobz?api-version=2021-02-01 未找到。"}]}}

在资源组部署中的门户上,我看到以下错误

{
"code": "DeploymentFailed",
"target": "/subscriptions/XXXXXX/resourceGroups/appA/providers/Microsoft.Resources/deployments/storResourceDeploy",
"message": "至少有一个资源部署操作失败。请列出详细的部署操作。请参阅 https://aka.ms/arm-deployment-operations 以获取使用详细信息。",
"details": [
{
"code": "HttpResourceNotFound",
"message": "请求网址 https://management.azure.com/subscriptions/XXXXXX/resourcegroups/appA/providers/Microsoft.Storage/storageAccounts/btestb12789/blobServices/blobz?api-version=2021-02-01 未找到。"
}
]
}

不确定原因是什么,它不应该找到资源,而应该创建它,任何建议都将有助于。谢谢

英文:

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

答案1

得分: 1

我找到了问题,问题不是上面的代码,而是它下面的代码,我之前没有发布它,因为我没有意识到它是问题所在。

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'
  }
}

确切地说,以下内容是不允许的,blob 服务的值应该仅设置为 "default",不能有其他名称。

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

一旦我将名称更改为 "default",它就正常工作了。谢谢大家。

英文:

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.

答案2

得分: 0

你示例中的 Blob 服务名称是 default,但这不是 Blob 服务的正确名称。Blob 服务的名称应该是 blobServices

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

The name of the Blob service in your example is default, but this is not the correct name for the Blob service. The Blob service name should be blobServices.

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

huangapple
  • 本文由 发表于 2023年7月20日 18:17:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76728869.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定