无法使用 NotificationHub + ApnsCredentials 部署 arm 模板

Can't deploy arm template with NotificationHub + ApnsCredentials

我正在使用 arm 模板部署 Azure NotificationHub 这里是

 {
  "apiVersion": "2017-04-01",
  "type": "Microsoft.NotificationHubs/namespaces/notificationHubs",
  "name": "[parameters('notificationHub_name')]",
  "location": "[parameters('location')]",
  "properties": {
    "GcmCredential": {
      "properties": {
        "googleApiKey": "[parameters('googleApiKey')]",
        "gcmEndpoint": "[parameters('googleEndpoint')]"
      }
    },
    "ApnsCredential": {
      "properties": {
        "appId": "[parameters('apnsAppId')]",
        "appName": "[parameters('apnsAppNameId')]",
        "keyId": "[parameters('apnsKeyId')]",
        "token": "[parameters('apnsToken')]",
        "endpoint": "[parameters('apnsEndpoint')]"
      }
    }
  },
  "dependsOn": [
    "[resourceId('Microsoft.NotificationHubs/namespaces', parameters('notificationHub_namespace'))]"
  ]
}

但是我得到了没有细节的错误BadRequest

{
  "code": "DeploymentFailed",
  "details": [
     {
      "code": "BadRequest",
      "message": {
         "error": {
           "message": "Bad Request",
           "code": "BadRequest"
         }
      } 
    ]
  }

我从 Azure 门户测试我的参数并且它有效 - 所以我假设参数是正确的。

问题是如何使用 ARM 部署带有 ApnsCredentials 的 NotificationHub?

上面的手臂模板是正确的。

我的参数不好。 我通过预览从 Azure 门户发送的请求找到了解决方案。

我正在为证书使用端点:

  • 沙盒端点:gateway.sandbox.push.apple.com、
  • 生产端点:gateway.push.apple.com

Endpoints for token authorization are different :

您可以在这里找到详细信息: https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-http2-token-authentification#configure-via-management-api-rest