Skip to content

Add compute resolution in job submit#7206

Open
saanikaguptamicrosoft wants to merge 2 commits intoAzure:foundry-training-devfrom
saanikaguptamicrosoft:saanika/computeresolve
Open

Add compute resolution in job submit#7206
saanikaguptamicrosoft wants to merge 2 commits intoAzure:foundry-training-devfrom
saanikaguptamicrosoft:saanika/computeresolve

Conversation

@saanikaguptamicrosoft
Copy link
Collaborator

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements real compute-name resolution for the azure.ai.customtraining extension by calling the Azure Resource Manager (ARM) control plane to translate a friendly compute name into a full ARM resource ID during job submission.

Changes:

  • Implement ARM-backed compute resolution (HTTP GET + token acquisition) and return the compute resource id.
  • Wire job submission to construct the compute resolver using subscription ID and resource group from the azd environment.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
cli/azd/extensions/azure.ai.customtraining/internal/service/compute_resolver.go Replaces the stub compute resolver with an ARM GET implementation that extracts the compute ARM ID.
cli/azd/extensions/azure.ai.customtraining/internal/cmd/job_submit.go Passes env-derived subscription/resource group/account + credential into the compute resolver used during job submission.
Comments suppressed due to low confidence (1)

cli/azd/extensions/azure.ai.customtraining/internal/cmd/job_submit.go:62

  • subscriptionID/resourceGroup are now required for compute-name resolution, but this command only validates accountName/projectName. In implicit init flows, AZURE_RESOURCE_GROUP_NAME is intentionally not set, which will cause compute resolution to fail later with a confusing ARM 404. Add a preflight validation for missing subscriptionID/resourceGroup and return a clear error (e.g., prompt to run azd ai training init or provide a full ARM compute ID in the YAML).
			subscriptionID := envValues[utils.EnvAzureSubscriptionID]
			resourceGroup := envValues[utils.EnvAzureResourceGroup]

			if accountName == "" || projectName == "" {
				return fmt.Errorf("environment not configured. Run 'azd ai training init' first")
			}

Comment on lines +59 to +67
reqURL := fmt.Sprintf(
"%s/subscriptions/%s/resourceGroups/%s/providers/Microsoft.CognitiveServices/accounts/%s/computes/%s?api-version=%s",
armBaseURL,
url.PathEscape(r.subscriptionID),
url.PathEscape(r.resourceGroup),
url.PathEscape(r.accountName),
url.PathEscape(computeName),
armComputeAPIVersion,
)
Comment on lines +15 to +21
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
)

const (
armBaseURL = "https://management.azure.com"
armComputeAPIVersion = "2026-01-15-preview"
Comment on lines +93 to +98
return "", fmt.Errorf(
"insufficient permissions to resolve compute '%s'.\n"+
" Provide the full ARM resource ID in your YAML instead:\n"+
" compute: /subscriptions/%s/resourceGroups/%s/providers/Microsoft.CognitiveServices/accounts/%s/computes/%s",
computeName, r.subscriptionID, r.resourceGroup, r.accountName, computeName,
)
}
defer resp.Body.Close()

body, _ := io.ReadAll(resp.Body)
@saanikaguptamicrosoft saanikaguptamicrosoft changed the title Saanika/computeresolve Add compute resolution in job submit Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants