使用AzureDevops部署失败

时间:2019-08-12 19:16:05

标签: azure github azure-devops azure-cli

我正在关注Azure Devops实验室:https://azuredevopslabs.com/labs/vstsextend/github-azurepipelines/#task-4-embedding-automated

但是当我部署应用程序时,会出现此错误:

There were errors in your deployment.     
Error code: DeploymentFailed.  
[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
[error]Details:  
[error]BadRequest: {  
"error": {
"code": "InternalServerError",
"message": "There was an unexpected InternalServerError. Please try again
later. x-ms-correlation-request-id: a016b467-fbd6-4851-a411-30f253ad4854"  
}  
} undefined  
[error]Task failed while creating or updating the template deployment.

我不知道哪个参数是错误的,我尝试进行手动部署,但仍然失败。

随附的是我用于进行部署的部署详细信息。

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "p_environment": {
        "type": "string"
    },
    "p_separator": {
        "defaultValue": "-",
        "type": "string"
    },
    "p_site_prefix": {
        "defaultValue": "githubci",
        "type": "string"
    },
    "p_site_web_name": {
        "defaultValue": "web",
        "type": "string"
    },
    "p_comosdb_name": {
        "defaultValue": "db",
        "type": "string"
    }
},
"variables": {
    "site_web_name": "[concat(parameters('p_site_prefix'), parameters('p_separator'), parameters('p_site_web_name'), parameters('p_separator'), parameters('p_environment'))]",
    "comosdb_default_name": "[concat(parameters('p_site_prefix'), parameters('p_separator'), parameters('p_comosdb_name'), parameters('p_separator'), parameters('p_environment'))]"
},
"resources": [
    {
        "type": "Microsoft.DocumentDB/databaseAccounts",
        "kind": "MongoDB",
        "name": "[variables('comosdb_default_name')]",
        "apiVersion": "2015-04-08",
        "location": "[resourceGroup().location]",
        "tags": {
            "defaultExperience": "MongoDB"
        },
        "scale": null,
        "properties": {
            "name": "[variables('comosdb_default_name')]",
            "databaseAccountOfferType": "Standard",
            "consistencyPolicy": {
                "defaultConsistencyLevel": "Session",
                "maxIntervalInSeconds": 5,
                "maxStalenessPrefix": 100
            }
        },
        "dependsOn": []
    },
    {
        "type": "Microsoft.Web/sites",
        "kind": "app",
        "name": "[variables('site_web_name')]",
        "apiVersion": "2016-08-01",
        "location": "[resourceGroup().location]",
        "properties": {
            "name": "[variables('site_web_name')]",
            "reserved": false,
            "siteConfig": {
                "appSettings": [
                    {
                        "name": "COSMOS_DB_NAME",
                        "value":"[variables('comosdb_default_name')]"
                    },
                    {
                        "name": "COSMOS_DB_AUTH_KEY",
                        "value": "[listKeys(resourceId('Microsoft.DocumentDb/databaseAccounts', variables('comosdb_default_name')), '2015-04-08').primaryMasterKey]"
                    },
                    {
                        "name": "WEBSITE_NODE_DEFAULT_VERSION",
                        "value": "8.9.4"
                    }
                ]
            }
        },
        "dependsOn": [
            "[concat('Microsoft.DocumentDB/databaseAccounts/', variables('comosdb_default_name'))]"
        ]
    }
],
"outputs": {
    "web": {
            "type": "string",
             "value": "[variables('site_web_name')]"
            }
    }
}

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我已经从头到尾检查了整个部署过程。我也遇到同样的错误。看来本教程创建了一个新的资源组,但没有在该资源组内创建要部署的新Web应用程序。要成功部署,请在资源组中创建一个名为“ githubci-web-”的webapp,然后再次运行部署。会成功的。