Add compute resolution in job submit#7206
Open
saanikaguptamicrosoft wants to merge 2 commits intoAzure:foundry-training-devfrom
Open
Add compute resolution in job submit#7206saanikaguptamicrosoft wants to merge 2 commits intoAzure:foundry-training-devfrom
saanikaguptamicrosoft wants to merge 2 commits intoAzure:foundry-training-devfrom
Conversation
Contributor
There was a problem hiding this comment.
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/resourceGroupare now required for compute-name resolution, but this command only validatesaccountName/projectName. In implicit init flows,AZURE_RESOURCE_GROUP_NAMEis intentionally not set, which will cause compute resolution to fail later with a confusing ARM 404. Add a preflight validation for missingsubscriptionID/resourceGroupand return a clear error (e.g., prompt to runazd ai training initor 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.