0
I am trying to use an Azure compute cluster and I am trying to build an environment as part of the process with the below code snippet.
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
# import required libraries for environments examples
from azure.ai.ml.entities import Environment, BuildContext
# Enter details of your Azure Machine Learning workspace
subscription_id = "<The subscription_id >"
resource_group = "The resource_group "
workspace = "The workspace"
# connect to the workspace
ml_client = MLClient(
DefaultAzureCredential(), subscription_id, resource_group, workspace,
)
env_docker_conda = Environment(
image="mcr.microsoft.com/azureml/curated/acpt-pytorch-2.1-cuda12.1:10",
conda_file="/path to conda env file",
name="name of env",
description="description of env",
)
ml_client.environments.create_or_update(env_docker_conda)
I get the following error (from the last line) when I run it:
azure.core.exceptions.ClientAuthenticationError: (InvalidAuthenticationTokenTenant) The access token is from the wrong issuer ‘ https://sts.windows.net/33e01921-4d64-4f8c-a055-5bdaffd5e33d/’. It must match the tenant ‘ https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/’ associated with this subscription. Please use the authority (URL) ‘ https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47’ to get the token. Note, if the subscription is transferred to another tenant there is no impact to the services, but information about new tenant could take time to propagate (up to an hour). If you just transferred your subscription and see this error message, please try back later.
I have tried the following so far
az login –tenant ‘The tenant id’ az account set –subscription ‘The subscription id’ in azure cli and also set os.environ[‘AZURE_TENANT_ID’]=”My tenant id”
The authority (URL) in the error message leads to a page not found page.
Srijith Radhakrishnan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.