2017-09-04 9 views
0

私はARMのテンプレートを作成して、それを使用していた:Azureの展開コードにサービス

  • リソースグループを作成します。
  • 作成およびアプリケーションサービス。
  • GitHub(repoUrl)のコードを前記のアプリケーションサービスに展開します。

GitHubの中に私のプロジェクトを配置するとすごくうれしいことですが、私たちはVSTS Gitを使ってコードを保持しています。 私にはこれを行うVSTSジョブを作成することができます。これは私たちがもう一度やるトラックですが、Visual StudioやPowershell ISEから直接実行する開発マシンからこれらのARMテンプレートを実行できる必要があります。

ほとんどすべては、それがサービスにVSTS Gitリポジトリからの私のC#プロジェクトを追加しようとするまで、私は、次の当たり障りのエラーレポートを取得する作品:

New-AzureRmResourceGroupDeployment : 16:08:30 - Resource Microsoft.Web/sites/sourcecontrols 'webapp1nameuniques83476y4589479/web' failed with message '{ 
    "status": "Failed", 
    "error": { 
    "code": "ResourceDeploymentFailure", 
    "message": "The resource operation completed with terminal provisioning state 'Failed'." 
    } 
}'At C:\Users\[removed my directory]\Deploy-AzureResources.ps1:119 char:5 
+  New-AzureRmResourceGroupDeployment -Name ((Get-ChildItem $Templat ... 
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception 
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet 

New-AzureRmResourceGroupDeployment : 16:08:30 - Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.At 
C:\Users\[removed my directory]\Deploy-AzureResources.ps1:119 char:5 
+  New-AzureRmResourceGroupDeployment -Name ((Get-ChildItem $Templat ... 
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception 
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet 

New-AzureRmResourceGroupDeployment : 16:08:30 - Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.At 
C:\Users\[removed my directory]\Deploy-AzureResources.ps1:119 char:5 
+  New-AzureRmResourceGroupDeployment -Name ((Get-ChildItem $Templat ... 
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception 
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet 

私が使用しているテンプレートは次のとおりです。

{ 
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
    "contentVersion": "1.0.0.0", 
    "parameters": { 
    "webapp1name": { 
     "type": "string", 
     "defaultValue": "webapp1nameuniques83476y4589479", 
     "metadata": { 
     "description": "The name of the web app that you wish to create." 
     } 
    }, 
    "webapp1hostingplan": { 
     "type": "string", 
     "defaultValue": "hostingplantestname", 
     "metadata": { 
     "description": "The name of the App Service plan to use for hosting the web app." 
     } 
    }, 
    "sku": { 
     "type": "string", 
     "allowedValues": [ 
     "F1", 
     "D1", 
     "B1", 
     "B2", 
     "B3", 
     "S1", 
     "S2", 
     "S3", 
     "P1", 
     "P2", 
     "P3", 
     "P4" 
     ], 
     "defaultValue": "S1", 
     "metadata": { 
     "description": "The pricing tier for the hosting plan." 
     } 
    }, 
    "workerSize": { 
     "type": "string", 
     "allowedValues": [ 
     "0", 
     "1", 
     "2" 
     ], 
     "defaultValue": "0", 
     "metadata": { 
     "description": "The instance size of the hosting plan (small, medium, or large)." 
     } 
    }, 
    "repoURL": { 
     "type": "string", 
     "metadata": { 
     "description": "The URL for the GitHub repository that contains the project to deploy." 
     } 
    }, 
    "branch": { 
     "type": "string", 
     "defaultValue": "master", 
     "metadata": { 
     "description": "The branch of the GitHub repository to use." 
     } 
    } 
    }, 
    "resources": [ 
    { 
     "apiVersion": "2015-08-01", 
     "name": "[parameters('webapp1hostingplan')]", 
     "type": "Microsoft.Web/serverfarms", 
     "location": "[resourceGroup().location]", 
     "sku": { 
     "name": "[parameters('sku')]", 
     "capacity": "[parameters('workerSize')]" 
     }, 
     "properties": { 
     "name": "[parameters('webapp1hostingplan')]" 
     } 
    }, 
    { 
     "apiVersion": "2015-08-01", 
     "name": "[parameters('webapp1name')]", 
     "type": "Microsoft.Web/sites", 
     "location": "[resourceGroup().location]", 
     "dependsOn": [ 
     "[resourceId('Microsoft.Web/serverfarms', parameters('webapp1hostingplan'))]" 
     ], 
     "properties": { 
     "serverFarmId": "[parameters('webapp1hostingplan')]" 
     }, 
     "resources": [ 
     { 
      "apiVersion": "2015-08-01", 
      "name": "web", 
      "type": "sourcecontrols", 
      "dependsOn": [ 
      "[resourceId('Microsoft.Web/Sites', parameters('webapp1name'))]" 
      ], 
      "properties": { 
      "RepoUrl": "[parameters('repoURL')]", 
      "branch": "[parameters('branch')]", 
      "IsManualIntegration": true 
      } 
     } 
     ] 
    } 
    ] 
} 

作成されたすべてのリソースで終了しますが、アプリケーションサービスにはコードプロジェクトがデプロイされていません。

私が間違っていることは何ですか?

+1

gitを確認しますか?あなたのテンプレートはうまく動作します。私はこの簡単な[ソース](https://github.com/azure-appservice-samples/ToDoApp.git)でテストします。テンプレートの問題ではないと私は思う。 –

+0

ええと、おそらく認可の問題です。恐ろしいエラーメッセージを受け取ります。 – Phish

答えて

0

これはVSITでホストされているGitリポジトリが公開されていないためです。これらはGitリポジトリ専用です。

回避策は、repo urlにクレデンシャルを追加することです。 enter image description here

+0

よろしくお願いします。 – Phish

+0

@Phish私は私の答えでスクリーンショットを追加しました。個人用のアクセストークンまたは代替の認証情報を使用することを忘れないでください。 –

+0

ありがとうございます。ただ確認するため?代替の資格情報(VSTSのクローンボタンの下に)を作成し、クローンURLのホストとビジュアルスタジオの参照の間に 'uname @ pword'を追加するだけですか? – Phish

関連する問題