Azure通知中心安装

时间:2016-02-16 09:45:35

标签: azure installation

快速提问。如何使用模板创建安装?你能给我举个例子吗?如何构建' InstallationTemplate'对象

1 个答案:

答案 0 :(得分:0)

如果要基于Microsoft.NotificationHubs的json架构创建ARM模板:

  • 在Visual Studio 2015中创建一个新项目。
  • 选择云项目
  • 选择Azure资源组
  • 选择空白模板
  • 打开azuredeploy.json

你会看到:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
    },
    "variables": {
    },
    "resources": [
    ],
    "outputs": {
    }
}

然后输入apiVersion来开始资源部分(注意你已经知道了intellisense):

"resources": [
    {
       "apiVersion": ""
    }
  ],

在此之后添加类型:只需选择正确的值 设置类型后。您将获得允许属性的智能感知。 有更多参数可用。但是在使用主要属性时 创建硬编码值的参数,最后你会得到一个模板,如:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "namespaceLocation": {
        "type": "string"
      },
      "namespaceName": {
        "type": "string"
      },
      "notificationHubName": {
        "type": "string"
      }
  },
    "variables": {
    },
  "resources": [
    {
      "apiVersion": "2014-09-01",
      "name": "[parameters('namespaceName')]",
      "type": "Microsoft.NotificationHubs/namespaces",
      "location": "[parameters('namespaceLocation')]",
      "properties": {
        "name": "[parameters('namespaceName')]",
        "namespaceType": "NotificationHub"
      },
      "resources": [
        {
          "apiVersion": "2014-09-01",
          "name": "[parameters('notificationHubName')]",
          "type": "Microsoft.NotificationHubs/namespaces/notificationHubs",
          "location": "[parameters('namespaceLocation')]",
          "dependsOn": [
            "[concat('Microsoft.NotificationHubs/namespaces/', parameters('namespaceName'))]"
          ],
          "properties": {
            "name": "[parameters('notificationHubName')]"           
          }
        }
      ]
    }
  ],
    "outputs": {
    }
}
相关问题