How to find the Azure Container Registry URL for an Azure ML environment registered from a local Dockerfile?

G Cocci 216 Reputation points Microsoft Employee
2025-03-14T14:11:24.4+00:00

I registered an environment in Azure Machine Learning starting from a local Dockerfile and context with CLI v2.

Now I want to retrieve in which repository on the Azure Container Registry this image was pushed by AML during the environment registration (the url that appears in the UI under Azure container registry when I open the environment details).

I tried using the Python SDK v2 and the CLI, but without success. Both az ml environment show and env = ml_client.environments.get(name=ENVIRONMENT_NAME, version=ENV_VERSION) do not return this information.

Additional info:
I don't want to register from an ACR in the first place, the data scientists must have the freedom to register they environment from their local machine. I need to retrieve the environment ACR url to be able to share it externally.

Thanks

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,335 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Suwarna S Kale 3,391 Reputation points
    2025-03-14T18:11:56.2533333+00:00

    Hello G Cocci,

    Thank you for posting your question in the Microsoft Q&A forum.

    To retrieve the Azure Container Registry (ACR) repository URL for an environment registered in Azure Machine Learning (AML) using a local Dockerfile and context, you can use the Azure ML Python SDK v2 or CLI v2. However, the ACR URL is not directly exposed in the environment details returned by these tools. Instead, you can extract this information by querying the underlying Azure resources.

    While the ACR repository URL is not directly exposed in the environment details returned by the Azure ML Python SDK v2 or CLI v2, you can retrieve it by parsing the environment build logs or querying the Azure Container Registry. By automating this process, you can efficiently share the ACR repository URL externally, enabling data scientists to register environments from their local machines while maintaining visibility into the underlying resources.

    You may refer to the documentation below for more info:

    https://learn.microsoft.com/en-us/azure/container-registry/container-registry-get-started-azure-cli

    https://learn.microsoft.com/en-us/azure/machine-learning/how-to-configure-cli?view=azureml-api-2&tabs=public

    https://learn.microsoft.com/en-us/python/api/overview/azure/ai-ml-readme?view=azure-python

    If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue. Your contribution to the Microsoft Q&A community is highly appreciated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.