gpt4 book ai didi

azure - 如何使用 ARM 模板复制 Azure SQL 数据库

转载 作者:行者123 更新时间:2023-12-05 03:10:03 25 4
gpt4 key购买 nike

不确定 ARM 是否支持。我可以找到电源外壳 references仅。

最佳答案

您当前无法使用 ARM 模板部署 dacpac。上面的链接使用 PowerShell,但不使用 ARM。但是,您可以使用 ARM 模板从源数据库创建数据库作为副本。

查找任何 Azure 操作的示例模板的一个简单方法是在门户中执行该操作 - 在本例中是复制数据库 - 然后在门户中打开相应的资源组边栏选项卡,列出部署,找到部署刚刚提交并打开它。然后从菜单栏中选择 ViewTemplate 并检查"template"选项卡和“参数”选项卡。这些显示了完整的模板和实际使用的参数值。然后,您可以下载该模板以及随附的 Powershell 脚本。

对于数据库复制,这里是模板:

{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"databaseName": {
"type": "string"
},
"serverName": {
"type": "string"
},
"location": {
"type": "string"
},
"createMode": {
"type": "string"
},
"sourceDatabaseId": {
"type": "string"
},
"requestedServiceObjectiveName": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2014-04-01-preview",
"location": "[parameters('location')]",
"name": "[concat(parameters('serverName'), '/', parameters('databaseName'))]",
"properties": {
"createMode": "[parameters('createMode')]",
"sourceDatabaseId": "[parameters('sourceDatabaseId')]",
"requestedServiceObjectiveName": "[parameters('requestedServiceObjectiveName')]"
},
"type": "Microsoft.Sql/servers/databases"
}
]
}

对于数据库复制createMode = 'Copy'

并确保提供完全限定的资源 ID,格式如下:

"/subscriptions/<sub-id>/resourceGroups/<resourceGroupName>/providers/Microsoft.Sql/Servers/<server-name>/databases/<database-name>"

确保资源组名称大小写正确,并且服务器名称全部小写。

关于azure - 如何使用 ARM 模板复制 Azure SQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41259386/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com