Redis 缓存的 ARM 模板部署失败
ARM Template for Redis Cache failing to deploy
我正在尝试使用 ARM 模板部署 Redis 缓存,但它一直失败并出现以下错误:
{"code":"DeploymentFailed","message":"At least one resource deployment
operation failed. Please list deployment operations for details.
Please see https://aka.ms/arm-debug for usage
details.","details":[{"code":"BadRequest","message":"{\r\n \"error\":
{\r\n \"code\": \"LinkedInvalidPropertyId\",\r\n \"message\":
\"Property id 'GET-PREREQ-existingDiagnosticsStorageAccountId' at path
'properties.storageAccountId' is invalid. Expect fully qualified
resource Id that start with '/subscriptions/{subscriptionId}' or
'/providers/{resourceProviderNamespace}/'.\"\r\n }\r\n}"}]}
在网上搜索了资源,但我无法弄清楚到底出了什么问题。 Redis 缓存资源确实已创建,但部署并未完全成功。以下似乎失败了:
https://imgur.com/a/xsp0OqL
https://imgur.com/a/mpBBIAm
azuredeployredis.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"redisCacheName": {
"type": "string",
"defaultValue": "defaultRedisCacheName",
"metadata": {
"description": "The name of the Azure Redis Cache to create."
}
},
"redisCacheSKU": {
"type": "string",
"allowedValues": [
"Basic",
"Standard",
"Premium"
],
"defaultValue": "Standard",
"metadata": {
"description": "The pricing tier of the new Azure Redis Cache."
}
},
"redisCacheFamily": {
"type": "string",
"defaultValue": "C",
"metadata": {
"description": "The family for the sku."
},
"allowedValues": [
"C",
"P"
]
},
"redisCacheCapacity": {
"type": "int",
"allowedValues": [
0,
1,
2,
3,
4,
5,
6
],
"defaultValue": 1,
"metadata": {
"description": "The size of the new Azure Redis Cache instance. "
}
},
"enableNonSslPort": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "A boolean value that indicates whether to allow access via non-SSL ports."
}
},
"diagnosticsEnabled": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "A value that indicates whether diagnostics should be saved to the specified storage account."
}
},
"existingDiagnosticsStorageAccountId": {
"type": "string",
"metadata": {
"description": "Existing storage account for diagnostics."
}
}
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "[parameters('redisCacheName')]",
"type": "Microsoft.Cache/Redis",
"location": "[resourceGroup().location]",
"properties": {
"enableNonSslPort": "[parameters('enableNonSslPort')]",
"sku": {
"capacity": "[parameters('redisCacheCapacity')]",
"family": "[parameters('redisCacheFamily')]",
"name": "[parameters('redisCacheSKU')]"
}
},
"resources": [
{
"apiVersion": "2017-05-01-preview",
"type": "Microsoft.Cache/redis/providers/diagnosticsettings",
"name": "[concat(parameters('redisCacheName'), '/Microsoft.Insights/', parameters('redisCacheName'))]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Cache/Redis/', parameters('redisCacheName'))]"
],
"properties": {
"storageAccountId": "[parameters('existingDiagnosticsStorageAccountId')]",
"metrics": [
{
"timeGrain": "AllMetrics",
"enabled": "[parameters('diagnosticsEnabled')]",
"retentionPolicy": {
"days": 90,
"enabled": "[parameters('diagnosticsEnabled')]"
}
}
]
}
}
]
}
]
}
azuredeployredis.parameters.json:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"redisCacheName": {
"value": "xyz-redis-cache"
},
"existingDiagnosticsStorageAccountId": {
"value": "GET-PREREQ-existingDiagnosticsStorageAccountId"
}
}
}
我的意思是,错误清楚地表明您需要将 resourceId,而不是资源名称传递给 properties.storageAccountId。它应该看起来像这样:
/subscriptions/guid/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storagename
你可以使用resourceId()
函数来计算:
resourceId('subscriptionId', 'resourceGroupname', 'Microsoft.Storage/storageAccounts', 'storageaccountname')
仅当存储帐户在不同的订阅中时才需要订阅 ID 和资源组名称and\or资源组
我正在尝试使用 ARM 模板部署 Redis 缓存,但它一直失败并出现以下错误:
{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.","details":[{"code":"BadRequest","message":"{\r\n \"error\": {\r\n \"code\": \"LinkedInvalidPropertyId\",\r\n \"message\": \"Property id 'GET-PREREQ-existingDiagnosticsStorageAccountId' at path 'properties.storageAccountId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.\"\r\n }\r\n}"}]}
在网上搜索了资源,但我无法弄清楚到底出了什么问题。 Redis 缓存资源确实已创建,但部署并未完全成功。以下似乎失败了: https://imgur.com/a/xsp0OqL https://imgur.com/a/mpBBIAm
azuredeployredis.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"redisCacheName": {
"type": "string",
"defaultValue": "defaultRedisCacheName",
"metadata": {
"description": "The name of the Azure Redis Cache to create."
}
},
"redisCacheSKU": {
"type": "string",
"allowedValues": [
"Basic",
"Standard",
"Premium"
],
"defaultValue": "Standard",
"metadata": {
"description": "The pricing tier of the new Azure Redis Cache."
}
},
"redisCacheFamily": {
"type": "string",
"defaultValue": "C",
"metadata": {
"description": "The family for the sku."
},
"allowedValues": [
"C",
"P"
]
},
"redisCacheCapacity": {
"type": "int",
"allowedValues": [
0,
1,
2,
3,
4,
5,
6
],
"defaultValue": 1,
"metadata": {
"description": "The size of the new Azure Redis Cache instance. "
}
},
"enableNonSslPort": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "A boolean value that indicates whether to allow access via non-SSL ports."
}
},
"diagnosticsEnabled": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "A value that indicates whether diagnostics should be saved to the specified storage account."
}
},
"existingDiagnosticsStorageAccountId": {
"type": "string",
"metadata": {
"description": "Existing storage account for diagnostics."
}
}
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "[parameters('redisCacheName')]",
"type": "Microsoft.Cache/Redis",
"location": "[resourceGroup().location]",
"properties": {
"enableNonSslPort": "[parameters('enableNonSslPort')]",
"sku": {
"capacity": "[parameters('redisCacheCapacity')]",
"family": "[parameters('redisCacheFamily')]",
"name": "[parameters('redisCacheSKU')]"
}
},
"resources": [
{
"apiVersion": "2017-05-01-preview",
"type": "Microsoft.Cache/redis/providers/diagnosticsettings",
"name": "[concat(parameters('redisCacheName'), '/Microsoft.Insights/', parameters('redisCacheName'))]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Cache/Redis/', parameters('redisCacheName'))]"
],
"properties": {
"storageAccountId": "[parameters('existingDiagnosticsStorageAccountId')]",
"metrics": [
{
"timeGrain": "AllMetrics",
"enabled": "[parameters('diagnosticsEnabled')]",
"retentionPolicy": {
"days": 90,
"enabled": "[parameters('diagnosticsEnabled')]"
}
}
]
}
}
]
}
]
}
azuredeployredis.parameters.json:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"redisCacheName": {
"value": "xyz-redis-cache"
},
"existingDiagnosticsStorageAccountId": {
"value": "GET-PREREQ-existingDiagnosticsStorageAccountId"
}
}
}
我的意思是,错误清楚地表明您需要将 resourceId,而不是资源名称传递给 properties.storageAccountId。它应该看起来像这样:
/subscriptions/guid/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storagename
你可以使用resourceId()
函数来计算:
resourceId('subscriptionId', 'resourceGroupname', 'Microsoft.Storage/storageAccounts', 'storageaccountname')
仅当存储帐户在不同的订阅中时才需要订阅 ID 和资源组名称and\or资源组