@SydneyD I think you should be using service principal authentication for automated processes. Detailed steps to create a service principal are documented in this notebook along with other available options.
To summarize, you set a service principal with the required access role and then use the same while defining your workspace.
import os
from azureml.core.authentication import ServicePrincipalAuthentication
svc_pr_password = os.environ.get("AZUREML_PASSWORD")
svc_pr = ServicePrincipalAuthentication(
tenant_id="my-tenant-id",
service_principal_id="my-application-id",
service_principal_password=svc_pr_password)
ws = Workspace(
subscription_id="my-subscription-id",
resource_group="my-ml-rg",
workspace_name="my-ml-workspace",
auth=svc_pr
)
print("Found workspace {} at location {}".format(ws.name, ws.location))
Service principal password can be set as environment variable if it is for local testing or can be retried using Azure keyvault or a secret variable in Azure DevOps.
Hope this helps!!
If an answer is helpful, please click on or upvote
which might help other community members reading this thread.