-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Labels
Description
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
-
Connect to Azure Government:
Connect-AzAccount -Environment AzureUSGovernment -
Register an ACR repository pointing to a .azurecr.us endpoint:
Register-PSResourceRepository -Name MyACR -Uri 'https://.azurecr.us' -Trusted -ApiVersion ContainerRegistry -
Run Find-PSResource against the repository:
Find-PSResource -Name '*' -Repository MyACR -
Observe Unauthorized error.
Note: The same identity successfully authenticates via REST API token exchange
(ARM token → /oauth2/exchange → /oauth2/token → /v2/_catalog), confirming the
identity has AcrPull and the registry is reachable. The failure is isolated to
PSResourceGet's internal authentication path.
Expected behavior
Find-PSResource successfully authenticates using the active Az session and returns
the list of modules in the registry, consistent with how it behaves against
azurecr.io (commercial Azure) registries.Actual behavior
Find-PSResource returns Unauthorized regardless of Az session state:
Find-PSResource: Response returned status code: Unauthorized.
This occurs on both 1.1.1 and 1.2.0. The error is thrown immediately, indicating
the failure happens during PSResourceGet's internal token acquisition before any
registry query is attempted.Error details
Exception :
Type : Microsoft.PowerShell.PSResourceGet.UtilClasses.UnauthorizedException
TargetSite :
Name : MoveNext
DeclaringType : [Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls+<SendRequestAsync>d__63]
MemberType : Method
Module : Microsoft.PowerShell.PSResourceGet.dll
Message : Response returned status code: Unauthorized.
Source : Microsoft.PowerShell.PSResourceGet
HResult : -2146233088
StackTrace :
at Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls.SendRequestAsync(HttpRequestMessage message)
in C:\__w\1\s\PSResourceGet\src\code\ContainerRegistryServerAPICalls.cs:line 1164
at
Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls.GetHttpResponseJObjectUsingContentHeaders(String
url, HttpMethod method, String content, Collection`1 contentHeaders, ErrorRecord& errRecord) in
C:\__w\1\s\PSResourceGet\src\code\ContainerRegistryServerAPICalls.cs:line 1045
TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
CategoryInfo : InvalidResult: (Microsoft.PowerShel…lets.FindPSResource:FindPSResource) [Find-PSResource],
UnauthorizedException
FullyQualifiedErrorId : UnauthorizedRequest,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource
InvocationInfo :
MyCommand : Find-PSResource
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 16
Line : Find-PSResource -Name '*' -Repository SysOpsACR
Statement : Find-PSResource -Name '*' -Repository SysOpsACR
PositionMessage : At line:1 char:1
+ Find-PSResource -Name '*' -Repository SysOpsACR
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Find-PSResource
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
0
1Environment data
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 1.2.0 Microsoft.PowerShell.PSResourceGet {Compress-PSResource, Find-PSResource, Get-Instal…
Key : PSVersion
Value : 7.5.4
Name : PSVersion
Key : PSEdition
Value : Core
Name : PSEdition
Key : GitCommitId
Value : 7.5.4
Name : GitCommitId
Key : OS
Value : Microsoft Windows 10.0.26100
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 : WSManStackVersionVisuals
No response
Reactions are currently unavailable