调试ARM部署脚本的技术

时间:2020-03-29 12:16:25

标签: azure azure-devops

我正在学习ARM部署脚本,我想知道是否有可能不熟悉的调试工具和技术。通常,当我发布时,我会从日志记录错误消息中获得良好的反馈,但是知道我的部署脚本比im更大,并且我同时遇到三个错误,但没有有关脚本所指部分的信息!有更多信息,我不知道的功能或工具吗?

Here is the ARM script

这是atm中的错误:

    2020-03-29T11:05:22.8089784Z The detected encoding for file 'D:\a\r1\a\_Servicebus build\drop\ApimArmDeploy.json' is 'utf-8'
2020-03-29T11:05:22.8133243Z The detected encoding for file 'D:\a\r1\a\_Servicebus build\drop\ApimArmDeploy-Parameters.json' is 'utf-8'
2020-03-29T11:05:23.0663551Z Starting template validation.
2020-03-29T11:05:23.0677286Z Deployment name is ApimArmDeploy-20200329-110523-e3d8
2020-03-29T11:05:23.6326816Z Template deployment validation was completed successfully.
2020-03-29T11:05:23.6328017Z Starting Deployment.
2020-03-29T11:05:23.6329586Z Deployment name is ApimArmDeploy-20200329-110523-e3d8
2020-03-29T11:05:54.9249116Z There were errors in your deployment. Error code: DeploymentFailed.
2020-03-29T11:05:54.9299184Z ##[error]At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
2020-03-29T11:05:54.9309993Z ##[error]Details:
2020-03-29T11:05:54.9312243Z ##[error]BadRequest: {
  "error": {
    "code": "ValidationError",
    "message": "One or more fields contain incorrect values:",
    "details": [
      {
        "code": "ValidationError",
        "target": "representation",
        "message": "Data at the root level is invalid. Line 1, position 1."
      }
    ]
  }
}
2020-03-29T11:05:54.9330396Z ##[error]Conflict: {
  "error": {
    "code": "Conflict",
    "message": "System.InvalidOperationException: Runtime keys are stored on blob storage. This API doesn't support this configuration. Please change Environment variable AzureWebJobsSecretStorageType value to 'Files'. For more info, visit https://aka.ms/funcsecrets\r\n   at Kudu.Core.Functions.FunctionManager.<GetKeyObjectFromFile>d__9`1.MoveNext() in C:\\Kudu Files\\Private\\src\\master\\Kudu.Core\\Functions\\FunctionManager.cs:line 141\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Kudu.Core.Functions.FunctionManager.<GetFunctionSecretsAsync>d__12.MoveNext() in C:\\Kudu Files\\Private\\src\\master\\Kudu.Core\\Functions\\FunctionManager.cs:line 220\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Kudu.Services.Functions.FunctionController.<GetSecrets>d__12.MoveNext() in C:\\Kudu Files\\Private\\src\\master\\Kudu.Services\\Functions\\FunctionController.cs:line 141"
  }
}
2020-03-29T11:05:54.9361241Z ##[error]NotFound: {
  "error": {
    "code": "ResourceNotFound",
    "message": "The Resource 'Microsoft.Web/sites/tostore-apim' under resource group 'INT001-TestOrderStore-Cert' was not found."
  }
}
2020-03-29T11:05:54.9365605Z ##[error]Task failed while creating or updating the template deployment.
2020-03-29T11:05:54.9371498Z ##[section]Finishing: Azure Deployment: APIM

1 个答案:

答案 0 :(得分:2)

Microsoft的VS Code扩展名'Azure Resource Manager (ARM) Tools'提供了一定程度的语法突出显示,可以帮助您注意ARM模板中的错误。

在构建/发布管道上将System.Debug变量设置为true也会很有帮助,该管道提供详细的日志记录输出:

enter image description here