<ol>
<li>When you define a task in your YAML pipeline, you can specify the service connection to use within the task's configuration. This is done through the inputs section of the task definition.</li>
</ol>
<p>task: AzureResourceGroupDeployment@2
inputs:
azureSubscription: 'Your Azure Service Connection'
...</p>
<p>2.The service connections that are available in your Azure DevOps project settings are the ones that can be used in your pipeline. Ensure that the required service connection is properly defined in your Azure DevOps project before referencing it in your pipeline YAML.</p>

CC BY-SA 4.0
2023-10-25T16:30:03.773Z
2023-10-25T16:30:03.773Z
geeky_girl
<p>I deleted what I thought were unused service connections in Azure DevOps, and now I cannot change the connection on existing pipelines. The build pipelines are yaml based but the service connections were set in the UI, so the yaml doesn't contain AzureSubsciption definitions. If I try to run the build pipeline I get this:</p>
<p><a href="https://i.sstatic.net/xWwv3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xWwv3.png" alt="Service connection error" /></a></p>
<p>If I try to edit the pipeline, I get this:</p>
<p><a href="https://i.sstatic.net/ufe45.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ufe45.png" alt="Longer error" /></a></p>
<p>I have another service connection (GitHub App) that I have made available to all pipelines. Is there any way to fix the existing pipelines without having to re-create them? Here is the current yaml file for the builds:</p>
<pre><code> pool:
  vmImage: 'ubuntu-latest'

variables:
  MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
  MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'

steps:
- script: 'wget https://archive.apache.org/dist/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.zip'

- task: ExtractFiles@1
  inputs:
      archiveFilePatterns: 'apache-maven-3.8.6-bin.zip'
      destinationFolder: '$(build.sourcesdirectory)/maven'

- task: Cache@2
  inputs:
    key: 'maven | &quot;$(Agent.OS)&quot; | **/pom.xml'
    restoreKeys: |
      maven | &quot;$(Agent.OS)&quot;
      maven
    path: $(MAVEN_CACHE_FOLDER)
  displayName: Cache Maven local repo

- task: DownloadSecureFile@1
  inputs:
    secureFile: 'settings.xml'
  displayName: Download settings.xml file

- task: Maven@3
  inputs:
    mavenPomFile: 'pom.xml'
    mavenOptions: '-Xmx3072m $(MAVEN_OPTS)'
    publishJUnitResults: false
    javaHomeOption: 'JDKVersion'
    mavenVersionOption: 'Path'
    mavenPath: '$(build.sourcesdirectory)/maven/apache-maven-3.8.6'
    mavenAuthenticateFeed: true
    effectivePomSkip: false
    sonarQubeRunAnalysis: false
    goals: 'test'
  displayName: execute munit tests

- task: Maven@3
  inputs:
    mavenPomFile: 'pom.xml'
    mavenOptions: '-Xmx3072m $(MAVEN_OPTS)'
    publishJUnitResults: false
    javaHomeOption: 'JDKVersion'
    mavenVersionOption: 'Path'
    mavenPath: '$(build.sourcesdirectory)/maven/apache-maven-3.8.6'    
    mavenAuthenticateFeed: false
    effectivePomSkip: false
    sonarQubeRunAnalysis: false
    goals: 'package -DskipTests'
  displayName: package solution


- task: PublishPipelineArtifact@1
  inputs:
    targetPath: $(System.DefaultWorkingDirectory)
    artifact: 'drop'
  displayName: Publish deployment artifacts
</code></pre>

<azure-devops><azure-pipelines><yaml>
Deleted service connection in Azure DevOps and now cannot select a new one
BuildMePlease
# Deleted service connection in Azure DevOps and now cannot select a new one

(Asked by: username_0 on 2023-04-03)

I deleted what I thought were unused service connections in Azure DevOps, and now I cannot change the connection on existing pipelines. The build pipelines are yaml based but the service connections were set in the UI, so the yaml doesn't contain AzureSubsciption definitions. If I try to run the build pipeline I get this:

If I try to edit the pipeline, I get this:

I have another service connection (GitHub App) that I have made available to all pipelines. Is there any way to fix the existing pipelines without having to re-create them? Here is the current yaml file for the builds:
 pool:
  vmImage: 'ubuntu-latest'

variables:
  MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
  MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'

steps:
- script: 'wget https://archive.apache.org/dist/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.zip'

- task: ExtractFiles@1
  inputs:
      archiveFilePatterns: 'apache-maven-3.8.6-bin.zip'
      destinationFolder: '$(build.sourcesdirectory)/maven'

- task: Cache@2
  inputs:
    key: 'maven | "$(Agent.OS)" | **/pom.xml'
    restoreKeys: |
      maven | "$(Agent.OS)"
      maven
    path: $(MAVEN_CACHE_FOLDER)
  displayName: Cache Maven local repo

- task: DownloadSecureFile@1
  inputs:
    secureFile: 'settings.xml'
  displayName: Download settings.xml file

- task: Maven@3
  inputs:
    mavenPomFile: 'pom.xml'
    mavenOptions: '-Xmx3072m $(MAVEN_OPTS)'
    publishJUnitResults: false
    javaHomeOption: 'JDKVersion'
    mavenVersionOption: 'Path'
    mavenPath: '$(build.sourcesdirectory)/maven/apache-maven-3.8.6'
    mavenAuthenticateFeed: true
    effectivePomSkip: false
    sonarQubeRunAnalysis: false
    goals: 'test'
  displayName: execute munit tests

- task: Maven@3
  inputs:
    mavenPomFile: 'pom.xml'
    mavenOptions: '-Xmx3072m $(MAVEN_OPTS)'
    publishJUnitResults: false
    javaHomeOption: 'JDKVersion'
    mavenVersionOption: 'Path'
    mavenPath: '$(build.sourcesdirectory)/maven/apache-maven-3.8.6'    
    mavenAuthenticateFeed: false
    effectivePomSkip: false
    sonarQubeRunAnalysis: false
    goals: 'package -DskipTests'
  displayName: package solution


- task: PublishPipelineArtifact@1
  inputs:
    targetPath: $(System.DefaultWorkingDirectory)
    artifact: 'drop'
  displayName: Publish deployment artifacts

**Tags:** azure-devops, azure-pipelines, yaml


---

## 1 answers

### Answer by username_1 on 2023-10-25. Score: 0

1. When you define a task in your YAML pipeline, you can specify the service connection to use within the task's configuration. This is done through the inputs section of the task definition.

task: AzureResourceGroupDeployment@2
inputs:
azureSubscription: 'Your Azure Service Connection'
...

2.The service connections that are available in your Azure DevOps project settings are the ones that can be used in your pipeline. Ensure that the required service connection is properly defined in your Azure DevOps project before referencing it in your pipeline YAML.


---

