I’m trying to figure out how to obtain an authorized token to execute a Docker login to my Azure Container Registry (ACR). I created a Service Principal with federated credentials, but when I request the ACR token, I receive the error:
AADSTS500011: The resource principal named "https://ableacr.azurecr.io" was not found in the tenant named "[My Tenant Name].
I’ve confirmed that my login with Entra ID is correct, as I’m able to read my service information via the Graph API. However, I’m unsure how to obtain the token for my ACR. As shown in the images, I have the appropriate role assignment for my ACR. I use Node.js to achieve this, and here is my code snippet:
async retrieveFederatedAccessTokenAsync(credentials: FederatedCredentials) {
const authenticatedCredential = new ClientAssertionCredential(
credentials.tenantId,
credentials.appId,
async () => credentials.ssoToken,
);
const accessToken = await authenticatedCredential.getToken('https://ableacr.azurecr.io/.default');
}
Could you please help me understand how to get the token or what I need to configure in my Service Principal to achieve this?