我使用此脚本循环存储帐户阵列,并使用一些默认配置创建它们。
param storageAccounts array = [
'storage2312'
'storage2we1'
]
resource storage_Accounts 'Microsoft.Storage/storageAccounts@2021-04-01' = [ for storageName in storageAccounts :{
name: storageName
location: 'westeurope'
sku: {
name: 'Standard_RAGRS'
}
kind: 'StorageV2'
properties: {
allowCrossTenantReplication: true
minimumTlsVersion: 'TLS1_2'
allowBlobPublicAccess: false
allowSharedKeyAccess: true
networkAcls: {
bypass: 'AzureServices'
virtualNetworkRules: []
ipRules: []
defaultAction: 'Allow'
}
supportsHttpsTrafficOnly: true
encryption: {
services: {
file: {
keyType: 'Account'
enabled: true
}
blob: {
keyType: 'Account'
enabled: true
}
}
keySource: 'Microsoft.Storage'
}
accessTier: 'Hot'
}
}]
resource storage_Accounts_name_default 'Microsoft.Storage/storageAccounts/blobServices@2021-04-01' = [ for (storageName, i) in storageAccounts :{
parent: storage_Accounts[i]
name: storageName
properties: {
changeFeed: {
enabled: false
}
restorePolicy: {
enabled: false
}
containerDeleteRetentionPolicy: {
enabled: true
days: 7
}
cors: {
corsRules: []
}
deleteRetentionPolicy: {
enabled: true
days: 30
}
isVersioningEnabled: true
}
}]
脚本运行正常,存储帐户也已创建,但脚本在最后抛出以下错误:
{"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"NotFound","message":"{\r\n \"error\": {\r\n \"code\": \"HttpResourceNotFound\",\r\n \"message\": \"The request url resourcegroups/storageAccounts/providers/Microsoft.Storage/storageAccounts/storage2we1/blobServices/storage2we1?api-version=2021-04-01 is not found.\"\r\n }\r\n}"},{"code":"NotFound","message":"{\r\n \"error\": {\r\n \"code\": \"HttpResourceNotFound\",\r\n \"message\": \"The request url /resourcegroups/storageAccounts/providers/Microsoft.Storage/storageAccounts/storage2312/blobServices/storage2312?api-version=2021-04-01 is not found.\"\r\n }\r\n}"}]}}
手动创建存储帐户时,我将$logs
作为默认容器,但当我运行脚本并创建存储帐户时,容器下没有任何内容,我认为错误是由于此原因。使用二头肌时,我是否必须声明默认容器?任何帮助和解释都是最受欢迎的。
非常感谢
2条答案
按热度按时间ozxc1zmp1#
根据提供的
here
示例,请将以下代码行(在您配置blob服务的第二个代码段中)从:到
因此,有效的二头肌模板如下所示:
wz8daaqr2#
下面是具有更多泛型的替代解决方案
要创建的容器的定义
接下来,我们需要定义存储帐户
那么我们需要使用composition来定义容器
需要注意的几件事: