0

Ich verwende die folgende azuredeploy.json-Datei zum Einrichten des Benachrichtigungshubs in der Azure-Cloud. mit dem folgenden Code-SchnipselKonfigurieren des APNS.Certificate in der Armvorlage

{ 
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
    "contentVersion": "1.0.0.0", 
    "parameters": { 
     "Gcm.GoogleApiKey": { 
      "type": "string", 
      "metadata": { 
       "description": "Google Cloud Messaging API Key" 
      }, 
      "defaultValue": "AIzaSyAyp9MernKgMS3wFNM3yNWByiP-TaGrqEg" 
     }, 
     "APNS.Certificate": { 
      "type": "string", 
      "metadata": { 
       "description": "A certificate (in base 64 format) provided by Apple on the iOS Provisioning Portal" 
      }, 
      "defaultValue": "" 
     }, 
     "APNS.certificateKey": { 
      "type": "string", 
      "metadata": { 
       "description": "The Certificate Key provided by the iOS Provisioning Portal when registering the application" 
      }, 
      "defaultValue": "ce469bf21dfa7b9d595d4999bfaca8a94ea47e46" 
     }, 
     "APNS.endpoint": { 
      "type": "string", 
      "metadata": { 
       "description": "The APNS endpoint to which our service connects. This is one of two values: gateway.sandbox.push.apple.com for the sandbox endpoint or gateway.push.apple.com, for the production endpoint. Any other value is invalid." 
      }, 
      "allowedValues": [ 
       "gateway.sandbox.push.apple.com", 
       "gateway.push.apple.com" 
      ], 
      "defaultValue": "gateway.push.apple.com" 
     } 
    }, 
    "variables": { 
     "hubVersion": "[providers('Microsoft.NotificationHubs', 'namespaces').apiVersions[0]]", 
     "notificationHubNamespace": "[concat('hubv2', uniqueString(resourceGroup().id))]", 
     "notificationHubName": "notificationhub" 
    }, 
    "resources": [ 
     { 
      "name": "[variables('NotificationHubNamespace')]", 
      "location": "[resourceGroup().location]", 
      "type": "Microsoft.NotificationHubs/namespaces", 
      "apiVersion": "[variables('hubVersion')]", 
      "comments": "Notification hub namespace", 
      "properties": { 
       "namespaceType": "NotificationHub" 
      }, 
      "resources": [ 
       { 
        "name": "[concat(variables('NotificationHubNamespace'),'/',variables('NotificationHubName'))]", 
        "location": "[resourceGroup().location]", 
        "type": "Microsoft.NotificationHubs/namespaces/notificationHubs", 
        "apiVersion": "[variables('hubVersion')]", 
        "properties": { 
         "GcmCredential": { 
          "properties": { 
           "googleApiKey": "[parameters('Gcm.GoogleApiKey')]", 
           "gcmEndpoint": "https://android.googleapis.com/gcm/send" 
          } 
         } 
        }, 
        "dependsOn": [ 
         "[variables('NotificationHubNamespace')]" 
        ] 
       } 
      ] 
     } 
    ], 
    "outputs": { 
    } 
} 

Jetzt habe ich auch versucht, den Apfel Push-Benachrichtigungsdienst einzurichten:

"apnsCredential": { 
       "properties": { 
       "apnsCertificate": "[parameters('APNS.Certificate')]", 
       "certificateKey": "[parameters('APNS.certificateKey')]", 
       "endpoint": " gateway.sandbox.push.apple.com or gateway.push.apple.com", 
       } 
      } 

Mit den oben genannten Änderungen ausgeführt ich die Deploy-AzureResourceGroup.ps1 Powershell-Eingabeaufforderung und auf Ich erhalte einen Fehler mit der Nachricht 'Bad Request'

Kann mir jemand helfen, dieses Problem zu beheben.

+0

Sie benötigen weitere Informationen als 'Bad Request' –

+0

Haben Sie jemals diese Arbeit bekommen? – OffHeGoes

Antwort

0

Es ist unmöglich genau zu wissen, was das verursacht hat, ohne mehr über Ihre Umgebung/Einrichtung zu wissen. Nach this post könnte ein mögliches Problem sein, wie stark Ihr Passwort lautet:

Nach ein paar Stunden meine Haare herausziehen und nicht immer etwas über „Bad Request“, dachte ich, endlich ein Passwort zu verwenden, stärker als "pass @ word1". Ich werde verdammt sein, es hat funktioniert. Nicht nur das, aber Provisioning mit Azure Resource Manager ist asynchron, so dass Ihre Skripte viel früher als früher zu beenden, weil VMs Bereitstellung parallel.

Die Post empfiehlt Troubleshooting common Azure deployment errors with Azure Resource Manager.

0

Ich bin mir nicht sicher, dass Sie die apiVersion für Ihre Vorlagen dynamisch festlegen sollten. Sie variieren je nachdem, was Sie bereitstellen.

Siehe Best Practices:

Vermeiden Sie für einen Ressourcentyp einen Parameter oder eine Variable für die API-Version. Ressourceneigenschaften und -werte können nach Versionsnummer variieren. IntelliSense in einem Codeeditor kann das richtige Schema nicht bestimmen, wenn die API-Version auf einen Parameter oder eine Variable festgelegt ist. Codieren Sie stattdessen die API-Version in der Vorlage fest.

Die richtige apiVersion für die Benachrichtigung Hubs erscheint 2015-04-01 zu sein: https://github.com/Azure/azure-resource-manager-schemas/blob/master/schemas/2015-04-01/Microsoft.NotificationHubs.json

Verwandte Themen