Fix up ContainerRegistry Authentication for OCI#1949
Fix up ContainerRegistry Authentication for OCI#1949jborean93 wants to merge 1 commit intoPowerShell:masterfrom
Conversation
Updates the ContainerRegistry authentication logic to work with OCI compliant registries like `ghcr.io`. The changes skip using the Azure environment credentials unless the bearer service ends with `.azurecr.io` as these tokens are only useful for ACR. The Azure AccessToken to Bearer token exchange is also simplified with an unecessary step removed. A new special prefix is used for the username when a credential represents an Azure AccessToken. This is necessary to ensure that only these specific types of credentials will use the Azure specific steps for authentication.
|
@jborean93 thank you for the PR. I am going to have a look at this shortly. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@jborean93 sorry for the delay getting back to you, but the team spent some time looking at the code today. Can you confirm if you're able to find a package from a Github Container Registry with these changes, and if so please share the steps used. We've created a Github Container registry, with URL: When finding a package from Github container registry, we get a 404 error: We also tested Find-PSResource against our Azure Container Registry, and get a different error: |
PR Summary
Updates the ContainerRegistry authentication logic to work with OCI compliant registries like
ghcr.io. The changes skip using the Azure environment credentials unless the bearer service ends with.azurecr.ioas these tokens are only useful for ACR. The Azure AccessToken to Bearer token exchange is also simplified with an unecessary step removed.A new special prefix is used for the username when a credential represents an Azure AccessToken. This is necessary to ensure that only these specific types of credentials will use the Azure specific steps for authentication.
While this new prefix is technically a breaking change, it isn't documented and seems like it's mostly added for testing. With the new change it is now possible to use a credential that contains the Azure app client id and client secret which was not possible before. I'm happy to talk through this more but it is important that this is fixed before too many people rely on the existing behaviour.
PR Context
Fixes: #1946
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.