2017-09-25 5 views
0

내 Azure 템플릿에서 전용 웹 서비스가 전용 App Service Plan에 배포되도록 선택했거나 공유 App 서비스 계획을 사용하려는 경우 조건이 있습니다.Azure ARM 상태가 유효성 검사 도중 실패합니다

내가 무시하려는 전용 계획을 사용하지 않도록 선택한 경우 : - 나는 전용 앱 서비스 계획 를 배포 첫 번째 섹션 - 나는 웹 앱을 배포하고 전용 서비스 계획을 사용하는 두 번째 절을 참조하십시오.

그러면 세 번째 섹션이 사용되어 공유 된 앱 계획이있는 웹 앱을 배포합니다.

다음은 내 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": {} 
} 

: 나는 앱 서비스 계획 섹션에서 조건을 제거하고 난 전용 계획을 사용하지 않도록 요구하는 경우에는, 내 웹 응용 프로그램은 공유 계획을 사용하여 배포됩니다. 앱 서비스 계획도 배포됩니다.

은 작동하지 않습니다 무엇 :

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 버전을 추가해야합니다.