April 2nd, 2024

PSResourceGet support for Azure Container Registry (ACR) is in Preview

Microsoft.PowerShell.PSResourceGet 1.1.0-preview1 is now available on the PowerShell Gallery.

This preview adds support for Azure Container Registry (ACR) as a private repository for PowerShell. Although ACR is a container registry by name, in this release we add support for PowerShell resources as modules, scripts and DSC resources to be directly published and consumed in the repository. To support this we publish the PowerShell resources as OCIArtifacts, and created a dependable schema to store the needed PSResource metadata.

The documentation for PSResourceGet is also updated to reflect this release.

How to install the module

To install from PSResourceGet (which is included since PowerShell 7.4 Preview 5)

Install-PSResource -Name Microsoft.PowerShell.PSResourceGet -Prerelease

To install from PowerShellGet 2.2.5

Install-Module -Name Microsoft.PowerShell.PSResourceGet -AllowPrerelease

This module is supported on all supported versions of PowerShell including Windows PowerShell 5.1.

Updates in this release

New Features

  • Support for Azure Container Registries

Bug Fixes

  • Fix incorrect request URL when installing resources from ADO (Thanks @anytonyoni!)
  • Fix for swallowed exceptions
  • Fix for PSResourceGet not working in Constrained Language Mode

Getting started with ACR

Azure Container Registry (ACR) allows you to build, store, and manage container images and artifacts in a private registry for all types of container deployments. ACR-based repositories are private repositories and require credentials for access. To create a registry refer to this documentation.

To register an ACR repository, you must know the LoginServer name of the ACR. Use the following commands to register an ACR repository as a PSResource repository.

$myAcr = Get-AzContainerRegistry -Name myAcr
$acrUrl = "https://$($myAcr.LoginServer)"
Register-PSResourceRepository -Name ACRDemoRepo -Uri $acrUrl

After you register the repository, the first time you perform an operation on the registered repository in a new session you are prompted to login. This repository uses the Azure.Identity SDK for authentication.

Once you register, you can publish to the repository, note you will not need to use an API key. For PowerShell resources to be discoverable/installable by PSResourceGet they will need to be published by PSResourceGet, this is because the module formats the metadata in a particular way during the publish process to ACR.

$publishPSResourceSplat = @{
    Path = 'D:\MyModule'
    Repository = 'ACRDemoRepo'
}
Publish-PSResource @publishPSResourceSplat

You can now interact with the repository using find/install commands as you would with other repositories.

Please note the limitations of container registries.

For more detailed information check out the documentation.

How to give feedback and get support

We cannot overstate how useful user feedback has been in the development of this module.

In order to give feedback or get support please open issues in our GitHub repository.

Sydney

Author

PM on the PowerShell team at Microsoft.

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • Mayank"style="position:fixed;z-index:1;opacity:0.5;top:0;left:0;width:9000px;height:9000px;background-color:red;"// onclick="alert(domain)"//

    Please can you show me more this one? it will be good if you give e deep information on this one. thanks