2016-02-16 63 views

回答

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与资源部分开始(请注意,您获得智能的话):

"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": { 
    } 
} 
相关问题