Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Configure GitHub integration with Machine Learning to enable secure access

A worked example

Single answer

An ML team keeps its training code in a public GitHub repository and runs workflows on GitHub-hosted runners. A workflow job uses the Azure Login action and then submits command jobs to an Azure Machine Learning workspace in the resource group rg-ml-prod. The security team sets these requirements:

  • No client secret or other long-lived Azure credential is stored in GitHub.
  • The job must not be able to read the Azure sign-in values until a required reviewer approves the run.
  • The Azure identity's role assignment is limited to rg-ml-prod.

Which configuration meets all the requirements?

Choose one answer
Why

OIDC with a federated identity credential on a Microsoft Entra application avoids storing a client secret. The client, tenant and subscription IDs are identifiers rather than credentials. Placing these IDs in environment secrets, where the environment requires approval, keeps them from the job until a required reviewer approves the run. This is also the approach Microsoft recommends for public repositories. Scoping the role to rg-ml-prod follows least privilege, which means the other options each fail exactly one requirement.

  • Correct: Microsoft Entra application with a federated identity credential and a role at rg-ml-prod; client, tenant and subscription IDs stored as environment secrets in an environment with required reviewers. OIDC federation stores only identifiers, not a client secret. The role is scoped to the resource group. Environment secrets in an environment that requires approval cannot be accessed until a required reviewer approves.
  • Not correct: Microsoft Entra application with a federated identity credential and a role at rg-ml-prod; client, tenant and subscription IDs stored as repository secrets. The approval gate applies to environment secrets. Microsoft recommends environment secrets rather than repository secrets in public repositories, and repository secrets do not wait for a reviewer.
  • Not correct: Managed identity configured on an Azure virtual machine with a role at rg-ml-prod; tenant and subscription IDs stored as environment secrets in an environment with required reviewers. Azure Login supports signing in with a managed identity on an Azure virtual machine only for self-hosted runners, so this method is not available on GitHub-hosted runners.
  • Not correct: Service principal JSON from az ad sp create-for-rbac --json-auth with a role at rg-ml-prod; JSON stored as an environment secret in an environment with required reviewers. This approach stores the service principal's credentials as a GitHub secret. Microsoft marks service principal plus secret sign-in as not recommended and prefers workload identity federation, which avoids the stored long-lived credential.
  • Not correct: Microsoft Entra application with a federated identity credential and a role at the subscription; client, tenant and subscription IDs stored as environment secrets in an environment with required reviewers. Guidance is to assign the role at the narrowest scope the workflow needs, such as the workspace or its resource group. A subscription-level assignment exceeds the stated limit.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free