跳过模板输出评估

问题描述 投票:-1回答:1

如果我尝试部署我的手臂模板(类似这样)

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {},
  "variables": {
     "AAS": "TestAAS",
     "AFU": "TestAFU",    
},
  "resources": [
//define some resource here
],
  "outputs": {
"asName": {
      "type": "string",
      "value": "[variables('AAS')]"
    },
    "azureFunctionName": {
      "type": "string",
      "value": "[variables('AFU')]"
    }}
}

如果出于任何原因运行不正常,我将无法在Powershell中读取输出。我收到以下消息:

Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details

我应该怎么做,以便在执行错误的情况下将输出参数传递到powershell脚本中

我的Powershell代码:

 //Standard PowerShell code for Deploying ARM Template
 try 
  {

 Stop-AzureRmWebApp -ResourceGroupName $ResourceGroupName -Name $deployment.Outputs.item("AFU").value
 Suspend-AzureRmAnalysisServicesServer -Name $deployment.Outputs.item("AAS").value -ResourceGroupName $ResourceGroupName 
   }
 catch 
  {
        Write-Host "error here"
  }
azure azure-resource-manager arm-template
1个回答
0
投票

您在这里什么也不能做。仅当ARM模板流中没有错误时才生成输出。因此,您需要成功使用ARM模板才能检索到这些模板(无论使用哪种工具,这些模板背后的API始终相同)。

© www.soinside.com 2019 - 2024. All rights reserved.