通过Azure资源管理器从公共blob将.bacpac导入SQL Azure

时间:2021-05-03 02:43:20

I created a .bacpac from the original SQL Azure DB I want to import to a new database during my deployment process. To do this, I want to have a github page with the usual Deploy to Azure button, that in as close to one click performs the deployment task, and sets up my entire application.

我在部署过程中从原始SQL Azure DB创建了一个.bacpac,我想将其导入新数据库。为此,我希望有一个github页面,其中包含通常的Deploy to Azure按钮,只需一次单击即可执行部署任务,并设置我的整个应用程序。

To do this, however, I need to set up some initial data on the database. After consulting the internet, I saw the post Using Azure Resource Manager to Copy Azure SQL Databases, which had a similar issue.

但是,要做到这一点,我需要在数据库上设置一些初始数据。在咨询了互联网之后,我看到了使用Azure资源管理器复制Azure SQL数据库的帖子,其中存在类似的问题。

Right now, I have a MSDeploy extension running in the ARM template that deploys a website from a public azure blob. I'd ideally like to do this with the database too, but the command seems to require storageKeyType and storageKey parameters to be filled.

现在,我在ARM模板中运行了一个MSDeploy扩展,该扩展从公共azure blob部署网站。理想情况下我也喜欢用数据库做这个,但命令似乎需要填充storageKeyType和storageKey参数。

Is there any way to go around this limitation? Should I just give up and have my application perform the initial setup of the database? Sharing the storage key in a public github template does not seem like a very good plan!

有没有办法解决这个限制?我应该放弃并让我的应用程序执行数据库的初始设置吗?在公共github模板*享存储密钥似乎不是一个非常好的计划!

Here's a code snippet:

这是一段代码:

"resources": [
        {
          "name": "Import",
          "type": "extensions",
          "apiVersion": "2014-04-01-preview",
          "dependsOn": [
            "[variables('sqlsrvmymisName')]",
            "[variables('sqldbmymisName')]"
          ],
          "properties": {
            "storageUri": "https://publicblob.blob.core.windows.net/artifacts/publicblob.bacpac",
            "administratorLogin": "MasterAccount",
            "administratorLoginPassword": "P@ssw0rd",
            "operationMode": "Import",
            "storageKeyType": "Primary",
            "storageKey": ""
          }
        }
      ]

1 个解决方案

#1


4  

If you really want it to be public, try this:

如果你真的希望它公开,试试这个:

"storageKeyType": "SharedAccessKey",
"storageKey": "?",

#1


4  

If you really want it to be public, try this:

如果你真的希望它公开,试试这个:

"storageKeyType": "SharedAccessKey",
"storageKey": "?",