2017-09-25 13 views
0

私のAzureテンプレートでは、Web Appを専用App Service Planにデプロイしたい場合や、共有App Serviceプランを使用したい場合は条件を選択しました。Azure Azureの検証でエラーが発生しました

私は無視する専用のプランは使用しないことを選択した場合: を - 私は、専用のアプリケーションサービスプラン を展開最初のセクション - 私はWebアプリケーションをデプロイし、専用のサービスプランを使用して第二のセクションを。

3番目のセクションが使用され、共有アプリプランを使用してウェブアプリをデプロイします。

以下は、私のARMテンプレートの抜粋です。働いている何

{ 
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
    "contentVersion": "1.0.0.0", 
    "parameters": { 
    "_artifactsLocation": { 
     "type": "string" 
    }, 
    "_artifactsLocationSasToken": { 
     "type": "string" 
    }, 
    "environmentConfiguration": { 
     "type": "object" 
    } 
    }, 
    "variables": {}, 
    "resources": [ 
    { 
     "comments": "App Service Plan hosting all websites", 
     "apiVersion": "2017-05-10", 
     "name": "AppServicePlan", 
     "type": "Microsoft.Resources/deployments", 
     "condition": "[equals(parameters('environmentConfiguration').serverFarm.useDedicatedPlan, 'true')]", 
     "properties": { 
     "mode": "Incremental", 
     "templateLink": { 
      "uri": "[concat(parameters('_artifactsLocation'),'/Microsoft.Web/Asp.json',parameters('_artifactsLocationSasToken'))]", 
      "contentVersion": "1.0.0.0" 
     }, 
     "parameters": { 
      "environmentConfiguration": { 
      "value": "[parameters('environmentConfiguration')]" 
      } 
     } 
     } 
    }, 
    { 
     "comments": "Web apps on dedicated plan", 
     "apiVersion": "2017-05-10", 
     "name": "[concat('WebAppsDedicatedPlan-',parameters('environmentConfiguration').webApp.webApps[copyIndex()].name)]", 
     "type": "Microsoft.Resources/deployments", 
     "condition": "[equals(parameters('environmentConfiguration').serverFarm.useDedicatedPlan, 'true')]", 
     "copy": { 
     "name": "webAppCopy", 
     "count": "[length(parameters('environmentConfiguration').webApp.webApps)]" 
     }, 
     "dependsOn": [ 
     "[resourceId('Microsoft.Resources/deployments', 'AppServicePlan')]" 
     ], 
     "properties": { 
     "mode": "Incremental", 
     "templateLink": { 
      "uri": "[concat(parameters('_artifactsLocation'),'/Microsoft.Web/WebApp.json',parameters('_artifactsLocationSasToken'))]", 
      "contentVersion": "1.0.0.0" 
     }, 
     "parameters": { 
      "environmentConfiguration": { 
      "value": "[parameters('environmentConfiguration')]" 
      }, 
      "dependencies": { 
      "value": { 
      "webAppInfo": "[parameters('environmentConfiguration').webApp.webApps[copyIndex()]]", 
      "serverFarmId": "[reference('AppServicePlan').outputs.serverFarmId.value]" 
      } 
      } 
     } 
     } 
    }, 
    { 
     "comments": "Web apps on shared plan", 
     "apiVersion": "2017-05-10", 
     "name": "[concat('WebAppsOnSharedPlan-',parameters('environmentConfiguration').webApp.webApps[copyIndex()].name)]", 
     "type": "Microsoft.Resources/deployments", 
     "condition": "[equals(parameters('environmentConfiguration').serverFarm.useDedicatedPlan, 'false')]", 
     "copy": { 
     "name": "webAppCopy", 
     "count": "[length(parameters('environmentConfiguration').webApp.webApps)]" 
     }, 
     "dependsOn": [], 
     "properties": { 
     "mode": "Incremental", 
     "templateLink": { 
      "uri": "[concat(parameters('_artifactsLocation'),'/Microsoft.Web/WebApp.json',parameters('_artifactsLocationSasToken'))]", 
      "contentVersion": "1.0.0.0" 
     }, 
     "parameters": { 
      "environmentConfiguration": { 
      "value": "[parameters('environmentConfiguration')]" 
      }, 
      "dependencies": { 
      "value": { 
       "webAppInfo": "[parameters('environmentConfiguration').webApp.webApps[copyIndex()]]", 
       "serverFarmId": "[resourceId('sharedResources','Microsoft.Web/serverfarms','sharedasp')]" 
      } 
      } 
     } 
     } 
    } 
    ], 
    "outputs": {} 
} 

:私はアプリのサービスプランのセクションに条件を削除し、私は専用のプランを使用しないように頼む場合は、私のWebアプリケーションは、共有の計画を使用して展開されています。 (アプリサービスプランも展開されています)。

動作していないもの:どのよう

2017-09-25T11:55:49.7343682Z Creating deployment parameters. 
2017-09-25T11:55:49.7373683Z The detected encoding for file 
'd:\a\r1\a\output\iac\myapp.json' is 'utf-8' 
2017-09-25T11:55:49.7373683Z The detected encoding for file 
'd:\a\r1\a\output\iac\myapp.parameters.qa.json' is 'utf-8' 
2017-09-25T11:55:49.7373683Z Starting Deployment. 
2017-09-25T11:55:51.3725072Z There were errors in your deployment. 
Error code: InvalidTemplate. 2017-09-25T11:55:51.3735078Z 
##[error]Deployment template validation failed: 'The template resource 'Microsoft.Resources/deployments/WebAppsDedicatedPlan-appadmin' 
reference to 'Microsoft.Resources/deployments/AppServicePlan' requires 
an API version. Please see https://aka.ms/arm-template for usage 
details.'. 2017-09-25T11:55:51.3735078Z ##[error]Task failed while 
creating or updating the template deployment. 
2017-09-25T11:55:51.4295112Z ##[section]Finishing: Azure Deployment: 
Update resource group 

:私はアプリのサービスプランのセクションに条件を聞かせている場合、私は検証は、次のメッセージで失敗した専用プランを使用しないようにするために要求したときにそれを展開しないようにこの問題を解決できますか?

答えて

1

「テンプレートリソース 'Microsoft.Resources /展開/ WebAppsDedicatedPlan-AppAdminをMicrosoft.Resources /展開' へ 参照 '/ AppServicePlanは' APIのバージョンが必要です。

このエラーは、それを回避します。理解を深めるためにdocsを確認してください。これが原因でエラーになります:

指定されたリソースのAPIバージョンです。同じテンプレート内でリソースがプロビジョニングされていない場合は、このパラメータを含めます。通常、形式はyyyy-mm-ddです。

テンプレート外に作成されたリソースの参照機能にAPIバージョンを追加する必要があります

関連する問題