Azure Sql Server 和 SQL 数据库资源组

Azure SqlServer and SqlDatabase resource groups

我想使用 Azure 在单个 ResourceGroup 下为以下客户创建环境:

理想情况下,数据库将托管在属于不同资源组的服务器上,这样我就可以跨多个客户端利用弹性池。

当我尝试使用 New-AzureRmResourceGroupDeployment 执行此操作时,我收到一条错误消息,指出无法找到父 SqlServer。

我已经通过 PowerShell 创建了一个 SqlServer:

New-AzureRmSqlServer -servername "MyServer" -ResourceGroupName "Common" -Location "South Central US"

然后我尝试为 ClientA 部署:

New-AzureRmResourceGroup -Name 'ClientA' -Location "South Central US"
New-AzureRmResourceGroupDeployment -ResourceGroupName 'ClientA' -TemplateFile azure.ClientDeployment.json -Client 'ClientA'

我的部署配置是:

{
  "parameters": { ... }
  "variables": { ... }
  "resources": [

    {
      "name": "MySqlServer/ClientA",
      "type": "Microsoft.Sql/servers/databases",
      "location": "[resourceGroup().location]",
      "apiVersion": "2014-04-01",
      "tags": {},
      "location": "[resourceGroup().location]",
      "properties": {
        "edition": "Basic"
      },
    }

  ],
  "outputs": {  }
}

错误信息中的结果:

New-AzureRmResourceGroupDeployment : 5:04:33 PM - Resource Microsoft.Sql/servers/databases 'MySqlServer/ClientA' failed with message '{
  "code": "NotFound",
  "message": "Server 'MySqlServer' does not exist in resource group 'ClientA' in subscription '{...}'.",
  "target": null,
  "details": [],
  "innererror": []
}

请注意,两个资源组(Common 和 ClientA)都在相同的订阅和位置。

是否可以让一个资源组的 SqlServer 部分和另一个资源组的 SqlDatabase 部分?

目前无法将 SQLServer 与一个订阅(位置)及其数据库分离到另一个订阅。

请参阅 MSDN forum

中的类似问题

An Azure resource group is also defined to be a strong container for its resources, which defines their identity (look at the URI of all Azure resources), and propagation of role-based access rights, and controls resource lifetimes - thus granting access to a resource group grants rights to its resources and deleting a resource group deletes the resources it contains.

Combining the above means that the resource group that contains a server must also contain the databases hosted/nested on that server.

即使您尝试在单个订阅中创建所有内容并尝试在之后移动特定的 SQLDB 资源组。它不允许这样做(在 Portal 中)

对于您的情况,我认为在公共订阅中创建所有服务,其中位置公共或所有客户端都可以轻松访问。

您可以使用 AzureSpeed 从当前位置获取所有位置的延迟,并尝试在对所有客户端延迟最小的公共位置创建订阅。