Skip to content

Commit

Permalink
Update AAD token request target resource uri for ACR access (#4654)
Browse files Browse the repository at this point in the history
* update target resource uri

* resolve build errors

* update comment

* re-add ArmResourceManagerId

* add obsolete attribute

* make uri non-configurable

* remove local var

* move uri to config

* set as default ARM uri to avoid breaking OSS scenarios
  • Loading branch information
ShaunDonn2 authored Oct 2, 2024
1 parent a745775 commit 37a7b85
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public async Task<string> GetTokenAsync(string registryServer, CancellationToken
{
EnsureArg.IsNotNullOrEmpty(registryServer, nameof(registryServer));

var aadResourceUri = new Uri(_convertDataConfiguration.ArmResourceManagerId);
var aadResourceUri = _convertDataConfiguration.AcrTargetResourceUri;
string aadToken;
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ public class ConvertDataConfiguration
public ICollection<string> ContainerRegistryServers { get; } = new List<string>();

/// <summary>
/// ArmResourceManagerId to aquire AAD token for ACR access token since ACR is not an AAD resource.
/// AcrTargetResourceUri to acquire AAD token for ACR access token since ACR is not an AAD resource.
/// The value is "https://management.azure.com/" for AzureCloud and DogFood. Could be changed to "https://management.usgovcloudapi.net/" for Azure Government and "https://management.chinacloudapi.cn/ " for Azure China.
/// To enable Trusted Services scenarios, we must use the ACR-specific URI rather than the more generic ARM URI. https://dev.azure.com/msazure/AzureContainerRegistry/_wiki/wikis/ACR%20Specs/480000/TrustedServicesPatterns
/// The value is "https://containerregistry.azure.net/" for all cloud environments.
/// </summary>
public Uri AcrTargetResourceUri { get; set; } = new Uri("https://management.azure.com/");

/// <summary>
/// ArmResourceManagerId to acquire AAD token for ACR access token since ACR is not an AAD resource.
/// The value is "https://management.azure.com/" for AzureCloud and DogFood.
/// Could be changed to "https://management.usgovcloudapi.net/" for Azure Government and "https://management.chinacloudapi.cn/ " for Azure China.
/// </summary>
[Obsolete("Use AcrTargetResourceUri instead.")]
public string ArmResourceManagerId { get; set; } = "https://management.azure.com/";

/// <summary>
Expand Down

0 comments on commit 37a7b85

Please sign in to comment.