2016-03-30 6 views
1

Ich versuche, ein Webhook für Automation Runbook zu erstellen. Bisher habe ich folgendes erreicht:Erstellen Sie Azure Automation Runbook Webhook mithilfe von ARM-Vorlagen?

  1. erstellen Automation Konto
  2. Runbook erstellen

Hier ist die Vorlage, die ich verwende:

"resources": [ 
    { 
     "name": "[parameters('accountName')]", 
     "type": "Microsoft.Automation/automationAccounts", 
     "apiVersion": "2015-10-31", 
     "location": "[parameters('location')]", 
     "dependsOn": [ ], 
     "tags": { }, 
     "properties": { 
      "sku": { 
       "name": "[parameters('sku')]" 
      } 
     }, 
     "resources": [ 
      { 
       "name": "[variables('runbookName')]", 
       "type": "runbooks", 
       "apiVersion": "2015-10-31", 
       "location": "[parameters('location')]", 
       "dependsOn": [ 
        "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]" 
       ], 
       "tags": { }, 
       "properties": { 
        "runbookType": "Script", 
        "logProgress": "false", 
        "logVerbose": "false", 
        "publishContentLink": { 
         "uri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1", 
         "version": "1.0.0.0" 
        }, 
        "webhook": { 
         "name": "test" 
        } 
       } 
       ,"resources": [ 
        { 
         "apiVersion": "2015-10-31", 
         "type": "webhooks", 
         "name": "testwebhook", 
         "dependsOn": [ 
          "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'), '/runbooks/', variables('runbookName'))]" 
         ] 
        } 
       ] 
      }, 
      { 
       "name": "[parameters('credentialName')]", 
       "type": "credentials", 
       "apiVersion": "2015-10-31", 
       "location": "[parameters('location')]", 
       "dependsOn": [ 
        "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]" 
       ], 
       "tags": { }, 
       "properties": { 
        "userName": "[parameters('userName')]", 
        "password": "[parameters('password')]" 
       } 
      } 
     ] 
    } 
] 

Ich bin nicht kann einen Webhook erstellen. Nach der Suche konnte ich das Template-Schema zum Erstellen des Runbooks auch nicht finden. Jede Hilfe wird geschätzt.

Vielen Dank im Voraus

Antwort

1

Sie sollten die Webhook nicht in den Ressourcen Ihres Runbook, setzen, weil ein Webhook zu einem Automation Konto gehört, nicht ein Runbook. Hier ist ein Beispiel:

"resources": [ 
    { 
     "name": "[parameters('accountName')]", 
     "type": "Microsoft.Automation/automationAccounts", 
     "apiVersion": "2015-10-31", 
     "location": "[parameters('location')]", 
     "dependsOn": [ ], 
     "tags": { }, 
     "properties": { 
      "sku": { 
       "name": "[parameters('sku')]" 
      } 
     }, 
     "resources": [ 
      { 
       "name": "[variables('runbookName')]", 
       "type": "runbooks", 
       "apiVersion": "2015-10-31", 
       "location": "[parameters('location')]", 
       "dependsOn": [ 
        "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]" 
       ], 
       "tags": { }, 
       "properties": { 
        "runbookType": "Script", 
        "logProgress": "false", 
        "logVerbose": "false", 
        "publishContentLink": { 
         "uri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1", 
         "version": "1.0.0.0" 
        }, 
        "webhook": { 
         "name": "test" 
        } 
       } 
       ,"resources": [ 

       ] 
      }, 
      { 
       "apiVersion": "2015-10-31", 
       "type": "webhooks", 
       "name": "testwebhook", 
       "dependsOn": [ 
        "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]", 
        "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'), '/runbooks/', variables('runbookName'))]" 
       ], 
       "properties": { 
        "isEnabled": true, 
        "runbook": { 
         "name": "[variables('runbookName')]" 
        } 
       } 
      }, 
      { 
       "name": "[parameters('credentialName')]", 
       "type": "credentials", 
       "apiVersion": "2015-10-31", 
       "location": "[parameters('location')]", 
       "dependsOn": [ 
        "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]" 
       ], 
       "tags": { }, 
       "properties": { 
        "userName": "[parameters('userName')]", 
        "password": "[parameters('password')]" 
       } 
      } 
     ] 
    } 
] 

Nach dem Test mit der Vorlage oben, erhalte ich die folgende Meldung:

New-AzureRmResourceGroupDeployment : 9:35:31 AM - Resource Microsoft.Automation/automationAccounts/webhooks 'automationARMtest/testwebhook' failed with message '{"Message":"Invalid Uri"}' 
At line:1 char:1 
+ New-AzureRmResourceGroupDeployment -name automationARMtest -ResourceG ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception 
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupDeploymentCommand 

Wie was @ElizabethCooper unter sagte, ist Webhook noch nicht in ARM-Vorlage unterstützt. Ich habe bereits eine Feature-Anfrage eingereicht. Bitte wählen Sie here

+1

Automatisierung unterstützt derzeit keine Webhooks in ARM-Vorlagen. Es wäre großartig, wenn Sie eine Feedbackanfrage für dieses Feature für das Automatisierungsteam senden können. https://feedback.azure.com/forums/246290-automation –

Verwandte Themen