0

我正在尝试通过 ARM 模板在 Azure Government 中部署一个 Http 触发的 Azure Function App。最初我得到名称冲突错误存在冲突。无法解析远程名称:'sftestgovstorage.file.core.windows.net'。我试图通过点击链接来解决这个错误。之后我尝试列出功能应用程序键并尝试创建一个新键。我收到错误消息Internal Server Error

我什至尝试将 WEBSITE_CONTENTAZUREFILECONNECTIONSTRING 设置添加到带有后缀的存储帐户连接字符串的配置中;EndpointSuffix=core.usgovcloudapi.net。但我仍然无法列出或创建新的功能应用键。

我正在使用以下代码创建一个新的功能键

HttpClient _client = new HttpClient();
_client.DefaultRequestHeaders.Add("Authorization", "Bearer " + jwtToken);
var response = await 
_client.PostAsync($"https://functionAppName.azurewebsites.us/admin/host/keys/{keyName}", null);

使用的 ARM 模板是

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
"contentVersion": "1.0.0.0", 
"parameters": {
"coreFunctionApp_appServicePlanName": {
  "type": "string",
  "metadata": {
    "description": "Name of the app service plan to host core function app."      
     },
  "defaultValue": "SL360-Prod-BAM-Appsvc"
},
"coreFunctionApp_applicationInsightsName": {
  "type": "string",
  "metadata": {
    "description": "Name of the application insights for the core function 
  app."
  },
  "defaultValue": "SL360-Prod-BAM-AppInsights"
},
"coreFunctionAppName": {
  "type": "string",
  "metadata": {
    "description": "Name of the core function app"
  },
  "defaultValue": "SL360-Prod-BAM-FunApp"
},
"BAMConnectionString": {
  "type": "string",
  "metadata": {
    "description": "BAM Connection String"
  },
  "defaultValue": "SL360-BAMConnectionString"
},
"storageAccountName": {
  "type": "string",
  "metadata": {
    "description": "Name of the Storage account namespace"
  },
  "defaultValue": "SL360-Prod-BAM-Storage"
},
"storageContainerName": {
  "type": "string",
  "metadata": {
    "description": "Name of the Storage account container"
  },
  "defaultValue": "SL360-Prod-BAM-Storage-container"
},
"storageAccountType": {
  "type": "string",
  "defaultValue": "Standard_LRS",
  "allowedValues": [
    "Standard_LRS",
    "Standard_GRS",
    "Standard_RAGRS"
  ],
  "metadata": {
    "description": "Storage Account type"
  }
}
},
"variables": {
"storageAccountid": "
[concat(resourceGroup().id,'/providers/','Microsoft.Storage/storageAccounts/', 
parameters('storageAccountName'))]",
"serverFarmApiVersion": "2018-02-01",
"storageApiVersion": " 
[providers('Microsoft.Storage','storageAccounts').apiVersions[0]]",
"sitesApiVersion": "2018-11-01",
"insightsApiVersion": "2015-05-01"
},
"resources": [
{
  "type": "Microsoft.Storage/storageAccounts",
  "apiVersion": "[variables('storageApiVersion')]",
  "kind": "Storage",
  "location": "[resourceGroup().location]",
  "name": "[parameters('storageAccountName')]",
  "sku": {
    "name": "[parameters('storageAccountType')]"
  }
},
{
  "apiVersion": "[variables('serverFarmApiVersion')]",
  "dependsOn": [],
  "location": "[resourceGroup().location]",
  "name": "[parameters('coreFunctionApp_appServicePlanName')]",
  "properties": {
    "name": "[parameters('coreFunctionApp_appServicePlanName')]",
    "computeMode": "Dynamic"
  },
  "sku": {
    "name": "Y1",
    "tier": "Dynamic"
  },
  "type": "Microsoft.Web/serverfarms"
},
{
  "apiVersion": "[variables('insightsApiVersion')]",
  "location": "[resourceGroup().location]",
  "name": "[parameters('coreFunctionApp_applicationInsightsName')]",
  "properties": {
    "Application_Type": "web",
    "ApplicationId": " 
   [parameters('coreFunctionApp_applicationInsightsName')]"
  },
  "tags": {
    "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('coreFunctionAppName'))]": "Resource"
  },
  "type": "Microsoft.Insights/components"
},    {

  "apiVersion": "[variables('sitesApiVersion')]",
  "dependsOn": [
    "[resourceId('Microsoft.Web/serverfarms', 
parameters('coreFunctionApp_appServicePlanName'))]",
    "[resourceId('Microsoft.Insights/components', 
parameters('coreFunctionApp_applicationInsightsName'))]",
    "[resourceId('Microsoft.Storage/storageAccounts', 
parameters('storageAccountName'))]"
  ],
  "kind": "functionapp",
  "location": "[resourceGroup().location]",
  "name": "[parameters('coreFunctionAppName')]",
  "properties": {
    "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 
parameters('coreFunctionApp_appServicePlanName'))]",
    "siteConfig": {
      "appSettings": [
        {
          "name": "AzureWebJobsDashboard",
          "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', 
parameters('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
        },
        {
          "name": "AzureWebJobsStorage",
          "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', 
parameters('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
        },
        {
          "name": "FUNCTIONS_EXTENSION_VERSION",
          "value": "~2"
        },
        {
          "name": "WEBSITE_NODE_DEFAULT_VERSION",
          "value": "6.5.0"
        },
        {
          "name": "APPINSIGHTS_INSTRUMENTATIONKEY",
          "value": "[reference(concat('microsoft.insights/components/', 
parameters('coreFunctionApp_applicationInsightsName'))).InstrumentationKey]"
        }
      ]
    }
  },
  "type": "Microsoft.Web/sites"
},
],
"outputs": 
"StorageAccessKey": {
  "type": "string",
  "value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 
parameters('storageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value]"
}
}
}    

谁能帮我解决这个问题?

4

0 回答 0