How to auto-authenticate AML compute instance to start on a regular schedule?

Caiwen Wu 20 Reputation points Microsoft Employee
2025-01-16T22:49:43.1966667+00:00

Hi, I am trying to use Azure ML workspace to run Python notebooks on a regular basis to query Kusto data and conduct data processing. I created a Compute instance in AML, set up the starter shell script, and configured the Startup schedule of the compute instance. I also used User assigned identity as the authentication method. However, the Compute instance does not always start successfully with the schedule, when it failed, a banner would appear: "Your compute needs to be authenticated before you can mount data to it. Please use the authenticate button to sign in to receive the authentication token." How can I resolve it? Thank you!

Azure Machine Learning
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
{count} votes

Answer accepted by question author
  1. Vikram Singh 2,590 Reputation points Microsoft Employee Moderator
    2025-02-05T05:03:16.9+00:00

    Hello @Caiwen Wu ,

    As discussed, you can run Code as AML Jobs Instead of Notebooks. To automate scripts as jobs/pipelines (instead of interactive notebooks), please find the below docs:

    1. AML Jobs Overview: Create and submit jobs: Covers CLI v2 and SDK options for running code as jobs. Microsoft Docs: Submit and track Azure ML jobs
    2. Convert Notebooks to Jobs: Run notebooks as jobs: Steps to submit a notebook directly as an AML job. Microsoft Docs: Run Jupyter Notebooks as jobs
    3. AML Pipelines: Design workflows to automate multi-step tasks. Create pipelines for recurring jobs: Microsoft Docs: Create ML pipelines.
    4. Schedule Jobs: Use AML Pipelines with schedules or Azure Logic Apps. Trigger jobs on a schedule:

    Why Use Jobs Instead of Notebooks?

    • Jobs are designed for unattended execution (no interactive authentication required).
    • Jobs leverage the workspace’s managed identity by default.
    • Jobs can run on dedicated compute clusters, which auto-scale and cost less than persistent compute instances.
    • Logs and outputs are stored automatically in the AML workspace.

    Running Code as Azure Machine Learning (AML) Jobs Instead of Notebooks:

    • Submitting Training Jobs: Azure Machine Learning provides multiple methods to submit training jobs, allowing you to run your code as a job rather than within a notebook environment. This approach is beneficial for scaling and automating your machine learning workflows. For detailed instructions on configuring and submitting training jobs, consult the following resource: learn.microsoft.com
    • Running a Training Script as a Command Job: To convert your existing code into a script and execute it as a command job in Azure Machine Learning, you can follow the guidelines provided in this module: learn.microsoft.com

    If the reply was helpful please don't forget to upvote and/or accept as answer,

    Thank you

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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