【发布时间】:2017-09-04 15:15:21
【问题描述】:
我创建了一个 ARM 模板并将其用于:
- 创建资源组。
- 创建和应用服务。
- 将代码从 GitHub (repoUrl) 部署到上述应用服务。
当我将我的项目放在 GitHub 中时,一切都很好,但我们使用 VSTS Git 来保存我们的代码。 我知道我可以创建一个 VSTS 作业来为我做这件事,这是我们将再次进入的轨道,但是我们需要能够从我们的开发人员机器上运行这些 ARM 模板,直接从我们的 Visual Studios 或 Powershell ISE 运行。
几乎一切正常,直到它尝试将我的 C# 项目从 VSTS Git 添加到服务时,我收到以下乏味的错误报告:
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
}
}
]
}
]
}
以创建所有资源结束,但应用程序服务没有部署代码项目。
任何想法我做错了什么?
【问题讨论】:
-
你检查你的 git 吗?你的模板很好用。我用这个简单的source 测试它。我认为这不是模板问题。
-
嗯,那可能是授权问题 - 这些可怕的错误消息该死
-
我正在寻找同样的东西。我可以从 Github repo 部署代码,但没有我的项目 dll。我在我的应用服务中只看到依赖项 dll。我使用了这个公共回购github.com/azure-appservice-samples/ToDoApp。如何在 ARM 模板中指定我的项目 sln 路径?
标签: git azure arm azure-devops continuous-deployment