PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
476 stars 90 forks source link

ACR repository authentication - non-interactively #1622

Open Gijsreyn opened 3 months ago

Gijsreyn commented 3 months ago

Summary of the new feature / enhancement

It's awesome to see the investment the PowerShell team is making, and I really love seeing ACR being added as private repository capabilities.

However, my instant thought came to rise, is it also possible to connect to ACR repository non-interactively? Such scenario will be extremely useful when automating tasks.

Proposed technical implementation details (optional)

No response

SydneyhSmith commented 3 months ago

We support the whole Azure Identity sdk which includes non-interactive options, we plan to write a doc about using it in automation in the future, for our CI we use workload identity federation https://learn.microsoft.com/en-us/dotnet/api/overview/azure/identity-readme?view=azure-dotnet#defaultazurecredential

adityapatwardhan commented 3 months ago

Also storing the Az Access Token in Secret Store before registering can be used for non-interactive scenarios. Please see the documentation at: https://learn.microsoft.com/en-us/powershell/gallery/powershellget/how-to/credential-persistence?view=powershellget-3.x#add-a-credential-to-a-psresourcerepository

Gijsreyn commented 3 months ago

Thanks for the quick responses @SydneyhSmith and @adityapatwardhan. I might have been a bit to fast and should have just tried it out or could have asked the question in the community call when you presented it. Anyway, will give it a go. Thanks once again!

adityapatwardhan commented 3 months ago

No worries. Let us know how it goes. Feedback is invaluable.

Gijsreyn commented 3 months ago

@adityapatwardhan It wasn't even needed. I created it through Azure DevOps using the SPN from the Azure PowerShell task. Shared it for others if they want to see it at: https://gijsreijn.medium.com/build-and-publish-your-powershell-modules-to-azure-container-registry-using-azure-devops-c5aac13b001d

image