Skip to content

Using az CLI to connect to ADO on-premise with self signed certificate #20171

@penx

Description

@penx

Describe the bug

As per https://developercommunity.visualstudio.com/t/using-az-cli-with-self-signed-certificate/1567135?from=email

The on-premise Azure DevOps Server I’m trying to connect to with the Azure CLI has a self signed certificate. I can’t find any documentation on how to connect to it via the CLI, and suggestions in support requests I’ve found don’t appear to work.

This link seems to describe the required steps, but doesn't include instructions for macOS:

https://docs.microsoft.com/en-us/cli/azure/use-cli-effectively#work-behind-a-proxy

(1) Please can you document the process for logging in to an Azure Devops organization with a self signed certificate?

(2) I think I've figured out how do this on macOS but still get an error:

I’m on Mac OS X 11.6 and these are the steps I’ve tried:

  • I have the certificate for the server in my keychain already, so export this from Keychain Access as a pem file and save at “/path/to/devops.example.com.pem”
  • Create a new token at https://devops.example.com/Example/_usersSettings/tokens
  • az extension add --name azure-devops
  • az devops configure --defaults organization=https://devops.example.com/Example project=MyProject
  • REQUESTS_CA_BUNDLE="/path/to/devops.example.com.pem" az devops login --organization=https://devops.example.com/Example --debug

At this point, it fails with

urllib3.connectionpool: Retrying (Retry(total=2, connect=3, read=3, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))': /MyOrg/_apis

Command Name
az devops login Extension Name: azure-devops. Version: 0.20.0.

Errors:

Failed to authenticate using the supplied token.

Environment Summary

macOS-11.6-x86_64-i386-64bit, Darwin 20.6.0
Python 3.9.7
Installer: HOMEBREW

azure-cli 2.29.1 *

Extensions:
azure-devops 0.20.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions