简体   繁体   English

Sql 数据库弹性池和sku组合无效

[英]Sql Database Elastic pool and sku combination is invalid

I am able to create Sql Server, Sql database, sql elastic Pool Successfully using ARM templates.我能够创建 Sql 服务器、Sql 数据库、sql 弹性池成功使用 Z47F45E65244C17EC018771AEZD6 模板。 But when I trying to create new database with existing elastic pool name.但是当我尝试使用现有弹性池名称创建新数据库时。 I am getting below error.我得到以下错误。

Without elastic pool id, database is creating successfully.如果没有弹性池 ID,则数据库创建成功。

Both Sql database Elastic Pool and database are using same location, tier, edition etc.Also When tried in azure portal it created successfully. Sql 数据库弹性池和数据库都使用相同的位置、层、版本等。此外,在 azure 门户中尝试时,它创建成功。

 "error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
  {
    "code": "ElasticPoolSkuCombinationInvalid",
    "message": "Elastic pool 'sqlsamplepool' and sku 'Basic' combination is invalid."
  }
]

ARM Template: ARM 模板:

 {
 "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
 "parameters": {
  "collation": {
  "type": "string",
  "metadata": {
    "description": "The collation of the database."
  },
  "defaultValue": "SQL_Latin1_General_CP1_CI_AS"
},
"skutier": {
  "type": "string",
  "metadata": {
    "description": "The edition of the database. The DatabaseEditions enumeration contains all the 
    valid editions. e.g. Basic, Premium."
  },
  "allowedValues": [ "Basic", "Standard", "Premium" ],
  "defaultValue": "Basic"
},
"resourcelocation": {
  "type": "string",
  "defaultValue": "[resourceGroup().location]",
  "metadata": {
    "description": "Location for all resources."
  }
},
"sqlservername": {
  "type": "string",
  "metadata": {
    "description": "The name of the sql server."
  }
},
"zoneRedundant": {
  "type": "bool",
  "metadata": {
    "description": "Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones."
  },
  "defaultValue": false
},
"sqlElasticPoolName": {
  "type": "string",
  "metadata": {
    "description": "The Elastic Pool name."
  }
},
"databaseName": {
  "type": "string"
}
 },
 "functions": [],
"variables": {  },
  "resources": [
{
  "type": "Microsoft.Sql/servers/databases",
  "apiVersion": "2020-08-01-preview",
  "name": "[concat(parameters('sqlservername'),'/',parameter('databaseName'))]",
  "location": "[parameters('resourcelocation')]",
  "sku": {
    "name": "[parameters('skutier')]",
    "tier": "[parameters('skutier')]"
  },
  "properties": {
    "collation": "[parameters('collation')]",
    "zoneRedundant": "[parameters('zoneRedundant')]",
  "elasticPoolId":"[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Sql/servers/',parameters('sqlservername'),'/elasticPools/',parameters('sqlElasticPoolName'))]"
  }
 }
]
}

I am not sure what wrong with "2020-08-01-preview" version but its working fine with stable version.我不确定“2020-08-01-preview”版本有什么问题,但它在稳定版本中运行良好。 below is my partial arm template code that working.下面是我工作的部分 arm 模板代码。

I changed to 2014-04-01 api version.我更改为 2014-04-01 api 版本。

  "comments": "If Elastic Pool Name is defined, then curent database will be added to elastic pool.",
  "type": "Microsoft.Sql/servers/databases",
  "apiVersion": "2014-04-01",
  "name": "[concat(parameters('sqlservername'),'/',variables('dbname'))]",
  "location": "[parameters('resourcelocation')]",
  "properties": {
    "collation": "[parameters('collation')]",
    "zoneRedundant": "[parameters('zoneRedundant')]",
    "elasticPoolName":"[if(not(empty(parameters('sqlElasticPoolName'))),parameters('sqlElasticPoolName'),'')]",
    "edition": "[parameters('skutier')]"
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM