0
votes

##[error]Required: 'ConnectedServiceNameARM' input

This is in Azure DevOps using YAML inline script.

  1. Need help with what to enter to fix this error? I am really new at YAML. This is a inline YAML and what tried seems to break the YAML script. The ConnectedServiceNameARM is just the Azure Subscription name? My service connection in azure devops has a working azure subscription name so I am wondering what is wrong?

  2. Also need this YAML code to run so that the output file is placed in agent/_work/_tasks folder and not the artifacts folder. How would I move the file from the _tasks/Powershell folder to something that can be copied to share?


trigger:
- main

pool:
  name: 'CloudUiPath001'
  demands:
  - agent.name -equals UiPathAgent01

steps:

- task: AzurePowerShell@3

  displayName: 'Azure PowerShell script: InlineScript'

  inputs:

  

    ScriptType: InlineScript

    Inline: |
     $filePath='C:\Program Files (x86)\UiPath\Studio'
     $dir=(New-Object -com scripting.filesystemobject).getFolder($filePath).ShortPath
     $ProjectFilePath= "$(System.DefaultWorkingDirectory)/_TESTREPO7/project.json"
     $ExecutableFilePath=$dir+"\UiPath.Studio.CommandLine.exe"
     
     $OutputFilePath=".\$(Get-Date -Format 'yyyy-MM-dd-HH-mm-ss')-Workflow-Analysis.json"
     
     #This was an attempt to write the filename to a pipeline variable: Feel free to continue on this path if possible
     Write-Host "##vso[task.setvariable variable=jsonFilePath]$OutputFilePath"
     
     Write-Output "$(Get-Date -Format 'HH:mm:ss') - STARTED - Workflow Analyzer CLI Script"
     
     $Command = "$ExecutableFilePath analyze -p $ProjectFilePath"
     Invoke-Expression $Command | Out-File -FilePath $OutputFilePath
     
     Write-Output "$(Get-Date -Format 'HH:mm:ss') - COMPLETED - Workflow Analyzer CLI Script"

    azurePowerShellVersion: LatestVersion


How do I fix his error within a INLINE YAML script. I am new to YAML and when I tried to enter a input I got errors.

##[error]Required: 'ConnectedServiceNameARM' input

1

1 Answers

1
votes

According to your AzurePowerShell task definition, you don’t seem to specify the azureSubscription field.

steps:
- task: AzurePowerShell@5
  displayName: 'Azure PowerShell script: InlineScript'
  inputs:
    azureSubscription: 'xxx'
    ScriptType: InlineScript
    Inline: xxx
    azurePowerShellVersion: 'LatestVersion'

You can click the Settings shown in the figure below to specify the subscription.

enter image description here

enter image description here

About Azure PowerShell task, please refer to this document for details.