Skip to content

Installing a resource from ACR fails #1623

Closed
@diecknet

Description

@diecknet

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

I created an ACR like this:

#region config
$AzResourceGroupName = 'RG-PS-ACR'
$AzSubscriptionId    = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
$AzACRName           = 'diecknetgallery'
$AzACRSku            = 'Premium'
$AzRegion            = 'GermanyWestCentral'
#endregion config

# Sign into your Azure account (if necessary)
Connect-AzAccount
# Set context/subscription
Set-AzContext -Subscription $AzSubscriptionId
# Optional: Create a resource group
New-AzResourceGroup -Name $AzResourceGroupName -Location GermanyWestCentral
# Optional: Register subscription to use namespace
Register-AzResourceProvider -ProviderNamespace Microsoft.ContainerRegistry
# Create a container registry
$newAzContainerRegistrySplat = @{
    ResourceGroupName = $AzResourceGroupName
    Name = $AzACRName
    EnableAdminUser = $true
    Sku = $AzACRSku
    Location = $AzRegion
}
$registry = New-AzContainerRegistry @newAzContainerRegistrySplat

Then registered the registry on my local system (PowerShell 7.4.1, PSResourceGet 1.1.0-preview1) like this:

$myAcr = Get-AzContainerRegistry -Name diecknetgallery -ResourceGroupName RG-PS-ACR
$acrUrl = "https://$($myAcr.LoginServer)"
Register-PSResourceRepository -Name diecknetgallery -Uri $acrUrl -Trusted

Then published a small script to ACR like this:

$publishPSResourceSplat = @{
    Path = 'C:\diecknet\BeispielSkript\Beispiel-Skript.ps1'
    Repository = 'diecknetgallery'
}
Publish-PSResource @publishPSResourceSplat

So far so good. I can see that something got created in the ACR via the Azure portal:
grafik

I can also find the resource via Find-PSResource:

PS> Find-PSResource -Name beispiel-skript -Repository diecknetgallery

Name            Version Prerelease Repository      Description
----            ------- ---------- ----------      -----------
Beispiel-Skript 1.0                diecknetgallery  Ein einfaches Beispiel für ein Skript …

But I cannot actually install the resource via Install-PSResource

grafik

Expected behavior

PS> Install-PSResource -Name beispiel-skript -Repository diecknetgallery

*Resource installs successfully*

Actual behavior

PS> Install-PSResource -Name beispiel-skript -Repository diecknetgallery

Install-PSResource: Response returned status code package: Not Found.
Install-PSResource: Package(s) 'beispiel-skript' could not be installed from repository 'diecknetgallery'.

Error details

PS> Get-Error

Exception             :
    Type    : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
    Message : Package(s) 'beispiel-skript' could not be installed from repository
'diecknetgallery'.
    HResult : -2146233088
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
CategoryInfo          : InvalidData:
(Microsoft.PowerShel…s.InstallPSResource:InstallPSResource) [Install-PSResource],
ResourceNotFoundException
FullyQualifiedErrorId :
InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
InvocationInfo        :
    MyCommand        : Install-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 29
    Line             : Install-PSResource -Name beispiel-skript -Repository diecknetgallery
    Statement        : Install-PSResource -Name beispiel-skript -Repository diecknetgallery
    PositionMessage  : At line:1 char:1
                       + Install-PSResource -Name beispiel-skript -Repository
diecknetgallery
                       +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Install-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

PS> Get-Module Microsoft.PowerShell.PSResourceGet; $PSVersionTable

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.1.0      preview1   Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get…

Key   : PSVersion
Value : 7.4.1
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.4.1
Name  : GitCommitId


Key   : OS
Value : Microsoft Windows 10.0.22631
Name  : OS


Key   : Platform
Value : Win32NT
Name  : Platform


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions


Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions