为 Microsoft 提供请求 header。Scheduler/jobCollections/jobs

Provide request header for Microsoft.Scheduler/jobCollections/jobs

我想知道如何从我的 Azure WebApp 提供 user/password 来为我的 webjob

提供 header
            {
           "name": "[concat('TraitementTableAzure-', parameters('HeliosEnvironnementName'), '-js')]",
           "type": "jobs",
           "apiVersion": "2016-03-01",
           "location": "[resourceGroup().location]",
           "properties": {
              "action": {
                 "request": {
                    "method": "Post",
                    "uri": "[concat('https://', parameters('AzureWebAppWebJobs'), '.scm.azurewebsites.net/api/triggeredwebjobs/', parameters('HeliosEnvironnementName'), '_TraitementTableAzure/run')]",
                    "headers": {
                       "authorization": "[concat('Basic ', reference('???').???)]"                        }
                 },
                 "type": "Http",
                 "retryPolicy": {
                    "retryType": "Fixed"
                 }
              },
              "startTime": "[parameters('SchedulesStartTime').SchedulerTraitementTableAzureStartTime]",
              "recurrence": {
                 "frequency": "Day",
                 "interval": 1
              },
              "state": "Enabled"
           },
           "dependsOn": [
              "[resourceId('Microsoft.Scheduler/jobCollections', variables('AzureSchedulerName'))]"
           ],
           "tags": {
              "displayName": "Cedule_TraitementTableAzure"
           }
        },

我在 Azure 门户上找到了信息,但在 webjob 属性下的 ARM 模板中找不到。怎样才能参考我的ARM模板上蓝色箭头上的信息?

How can reference information on the blue arrow over my ARM template ?

如果我们想获取publishingPassword,那么我们可以通过列表函数在ARM模板中使用ListPublishingCredentials APIlist(concat('Microsoft.Web/sites/', parameters('websisteName') ,'/config/publishingcredentials'), '2016-08-01').properties.publishingPassword

根据您的模板,您似乎想要调用 WebJob REST API,如果是这样,authorization header 就是 base64(publishusername:publishpassword)

base64(concat(list(concat('Microsoft.Web/sites/', parameters('websisteName'),'/config/publishingcredentials'), '2016-08-01').properties.publishingUserName,':',list(concat('Microsoft.Web/sites/', parameters('websisteName') ,'/config/publishingcredentials'), '2016-08-01').properties.publishingPassword))

我写了一个演示在我这边测试它,它工作正常。

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "websisteName": {
      "type": "string"
    }
    },
    "resources": [],
    "outputs": {
      "base64Output": {
        "type": "string",
        "value": "[base64(concat(list(concat('Microsoft.Web/sites/', parameters('websisteName'),'/config/publishingcredentials'), '2016-08-01').properties.publishingUserName,':',list(concat('Microsoft.Web/sites/', parameters('websisteName') ,'/config/publishingcredentials'), '2016-08-01').properties.publishingPassword))]"
      }
    }
  }