【问题标题】:How to solve Deploying template using PowerShell script failed error如何解决使用 PowerShell 脚本部署模板失败错误
【发布时间】:2020-03-11 09:53:08
【问题描述】:

我正在尝试使用 azure 资源组模板从 Visual Studio 将 SQL SERVER 和 DATABASE 部署到 azure。但我总是收到此错误: 使用 PowerShell 脚本部署模板失败错误

stackoverflow 上的其他答案没有帮助。 这是 azuredeploy.json 文件中的代码

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "copydbAdminLogin": {
      "type": "string",
      "minLength": 1
    },
    "copydbAdminLoginPassword": {
      "type": "securestring"
    },
    "databasecopyName": {
      "type": "string",
      "minLength": 1
    },
    "databasecopyCollation": {
      "type": "string",
      "minLength": 1,
      "defaultValue": "SQL_Latin1_General_CP1_CI_AS"
    },
    "databasecopyEdition": {
      "type": "string",
      "defaultValue": "Basic",
      "allowedValues": [
        "Basic",
        "Standard",
        "Premium"
      ]
    },
    "databasecopyRequestedServiceObjectiveName": {
      "type": "string",
      "defaultValue": "Basic",
      "allowedValues": [
        "Basic",
        "S0",
        "S1",
        "S2",
        "P1",
        "P2",
        "P3"
      ],
      "metadata": {
        "description": "Describes the performance level for Edition"
      }
    }},
  "variables": {
    "copydbName": "[concat('copydb', uniqueString(resourceGroup().id))]"},
  "resources": [
    {
      "name": "[variables('copydbName')]",
      "type": "Microsoft.Sql/servers",
      "location": "[resourceGroup().location]",
      "apiVersion": "2014-04-01-preview",
      "dependsOn": [ ],
      "tags": {
        "displayName": "copydb"
      },
      "properties": {
        "administratorLogin": "[parameters('copydbAdminLogin')]",
        "administratorLoginPassword": "[parameters('copydbAdminLoginPassword')]"
      },
      "resources": [
        {
          "name": "AllowAllWindowsAzureIps",
          "type": "firewallrules",
          "location": "[resourceGroup().location]",
          "apiVersion": "2014-04-01-preview",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', variables('copydbName'))]"
          ],
          "properties": {
            "startIpAddress": "0.0.0.0",
            "endIpAddress": "0.0.0.0"
          }
        },
        {
          "name": "[parameters('databasecopyName')]",
          "type": "databases",
          "location": "[resourceGroup().location]",
          "apiVersion": "2014-04-01-preview",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', variables('copydbName'))]"
          ],
          "tags": {
            "displayName": "databasecopy"
          },
          "properties": {
            "collation": "[parameters('databasecopyCollation')]",
            "edition": "[parameters('databasecopyEdition')]",
            "maxSizeBytes": "1073741824",
            "requestedServiceObjectiveName": "[parameters('databasecopyRequestedServiceObjectiveName')]"
          }
        }
      ]
    }],
  "outputs": {}
}

请帮忙

【问题讨论】:

  • 确切的错误文本是什么?
  • 首先我得到“Get-AzureRmResourceGroup”一词未被识别为使用 PowerShell 脚本部署模板失败之后。
  • bash 脚本在两秒后打开和关闭,我没有机会输入部署前配置的密码

标签: .net azure azure-sql-database


【解决方案1】:

正如我所见,问题可能是,

您需要 AzureRM 依赖项,因此您需要运行以下命令:

Install-Module AzureRM

【讨论】:

  • 感谢您的回复。我已经通过电源外壳 ISE 安装了模块,之后我得到了同样的错误....
  • 你能把它到底是什么
  • stackoverflow.com/questions/42827788/… 检查这是否有帮助
  • 我已经检查过了。没有任何帮助
猜你喜欢
  • 2021-01-03
  • 2018-08-12
  • 2016-07-02
  • 1970-01-01
  • 2019-02-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多