azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

Unclear what I can achieve with 'az devops service-endpoint update'

Open jochenvw opened this issue 4 years ago • 13 comments

I'm looking for a way to update the service principal password my existing service connection to Azure RM. I thought az devops service-endpoint update could perhaps help me out, but I don't see how.

Is the only thing you can do with az devops service-endpoint update is toggle enable-for-all ? Is it not possible to update the --service-endpoint-configuration property ( in the create command ) ? I have a hard time believing that so is something missing from the documentation or am I misunderstanding something?

So would it be possible to do az devops service-endpoint update --service-endpoint-configuration "json-stuff-here"] ? Or - perhaps even nicer: az devops service-endpoint update --set authorization.parameters.password=password123 like you can do with az network firewall update for instance.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

jochenvw avatar Nov 11 '20 16:11 jochenvw

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @narula0781, @ashishonce, @romil07.


Issue meta data
Issue content: I'm looking for a way to update the service principal password my existing service connection to Azure RM. I thought `az devops service-endpoint update` could perhaps help me out, but I don't see how.

Is the only thing you can do with az devops service-endpoint update is toggle enable-for-all ? Is it not possible to update the --service-endpoint-configuration property ( in the create command ) ? I have a hard time believing that so is something missing from the documentation or am I misunderstanding something?

So would it be possible to do az devops service-endpoint update --service-endpoint-configuration "json-stuff-here"] ? Or - perhaps even nicer: az devops service-endpoint update --set authorization.parameters.password=password123 like you can do with az network firewall update for instance.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Issue author: jochenvw
Assignees: -
Milestone: -

ghost avatar Nov 12 '20 02:11 ghost

ask on how to change Devops service connection credential. route to appropriate team.

yungezz avatar Nov 12 '20 02:11 yungezz

any updates on this?

rollan2001 avatar Jan 26 '21 07:01 rollan2001

I also have the same issue. For example, I need to update a service connection for a GKE Kubernetes cluster. At the moment, it seems I must delete and recreate to do that, which invalidates my release pipeline. The documentation also leaves much to be desired, unfortunately.

ThomasBarnekow avatar Jan 28 '21 14:01 ThomasBarnekow

I also have the same issue. I need to update the apitoken of the authorization via az devops service-endpoint update command, but there is no way to pass the args according to the official docs. Could the docs been updated?

Castafiore avatar Sep 17 '21 08:09 Castafiore

Hello,

It will be really nice to use AzCli to update service connection config such as certificate or password without having to delete/create (so we are not breaking any release pipeline :-) ) Any update on this issue ?

Simon

pwouavre avatar Apr 11 '22 14:04 pwouavre

Any updates please?

amansahni1 avatar Oct 12 '22 23:10 amansahni1

I'm convinced this command is a scam Microsoft plz.

Shningavus01 avatar Jan 12 '23 03:01 Shningavus01

Hello,

If anyone is interested, I'm updating ado service connection certificate by directly PUT new certificate in serviceendpoint API, here is an extract :

Write-Host "Updating service connection [$global:azserviceconnection] ..."
$uri = "$organization/$azProjectName/_apis/serviceendpoint/endpoints?endpointIds=$($serviceConnectionId)&api-version=6.0-preview.4"
$method = "GET"
$AzureDevOpsAuthenticationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($SpnToken)")) }
$serviceco = Invoke-RestMethod -Method $method -Uri $uri -Headers $AzureDevOpsAuthenticationHeader -ErrorAction 'Stop'

if ($serviceco.count -eq 1) {
  $method = "PUT"
  $uri = "$organization/_apis/serviceendpoint/endpoints/$($serviceConnectionId)?api-version=6.1-preview.4"
  $contentype = "application/json"

  $body = ($serviceco.value)
  if ($body.authorization.parameters.authenticationType -ne 'spnCertificate') {
    $body.authorization.parameters.authenticationType = 'spnCertificate'
  }
  $body.authorization.parameters | Add-Member -MemberType NoteProperty -Name 'servicePrincipalCertificate' -Value ($(Get-Content -Path $certificate.ServiceConnectionCertPath -Raw -ErrorAction 'Stop')) -ErrorAction 'Stop'
  $servicecoUpdate = Invoke-RestMethod -Method $method -Uri $uri -Headers $AzureDevOpsAuthenticationHeader -Body ($body | ConvertTo-Json -Depth 4) -ContentType $contentype -ErrorAction 'Stop'
  if ([string]::IsNullOrEmpty($servicecoUpdate)) {
    throw "There is an issue when updating Service Connection [$global:azserviceconnection] in projet [$azProjectName]"
  } else {
    Write-Host "Service Connection [$global:azserviceconnection] in project [$azProjectName] has been updated with success"
  }
}

Its working well, without breaking service connection id ;)

BR,

Simon

pwouavre avatar Jan 12 '23 11:01 pwouavre

@narula0781, @ashishonce, @romil07

I'm not familiar with GitHub etiquette so forgive me. Are there any examples of this command working at all?

Shningavus01 avatar Jan 12 '23 18:01 Shningavus01

Is there any activity or resolution on this issue or are we misunderstanding the point of the update command? I'd like to avoid having to curl and strictly use the azure devops cli extension for all operations.

casey-spires avatar Apr 19 '23 23:04 casey-spires

Any update in 2024? Facing same issue but it seems, that nobody taking case. It's more than 3years from initial post, but no reaction. Please can anybody from az cli team comment it at least?

ondrejmichlicekips avatar Jan 10 '24 21:01 ondrejmichlicekips

Any update? "Sorry, this is not possible." Can also be an update, but al least we know then.

njefsky avatar Feb 20 '24 11:02 njefsky