Upgrade armcognitiveservices to v2 to fix azd down for Foundry resources#8493
Conversation
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
azd down for Foundry resources
📋 Milestone: June 2026This work is tracked for June 2026. The team will review it soon! |
|
Tested with https://github.com/eamonoreilly/hosted-agents-vnet sample, with and without change:
|
There was a problem hiding this comment.
Pull request overview
This PR upgrades the Azure Cognitive Services ARM SDK used by azd core from armcognitiveservices v1.8.0 to armcognitiveservices/v2 v2.0.0 to fix azd down failures when the service returns properties.networkInjections as an array (which v1 cannot unmarshal).
Changes:
- Bump
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices→.../armcognitiveservices/v2incli/azd/go.modandcli/azd/go.sum. - Update import paths to
/v2across azd core packages and themicrosoft.azd.ai.builderextension code that’s built within thecli/azdmodule. - Update unit tests to use the
/v2import path.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/go.mod | Bumps Cognitive Services ARM SDK dependency to major version v2. |
| cli/azd/go.sum | Updates sums to match the v2 dependency bump. |
| cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go | Switches Cognitive Services SDK import to /v2 for the azd down purge path. |
| cli/azd/pkg/infra/provisioning/bicep/bicep_provider_coverage_test.go | Updates test imports to /v2 for compilation consistency. |
| cli/azd/pkg/azapi/cognitive_service.go | Updates Cognitive Services client imports to /v2 for account/model/usage operations. |
| cli/azd/pkg/azapi/cognitive_service_test.go | Updates test imports to /v2. |
| cli/azd/pkg/azapi/cognitive_service_coverage3_test.go | Updates test imports to /v2. |
| cli/azd/pkg/ai/model_service.go | Updates Cognitive Services SDK import to /v2 for model catalog and quota logic. |
| cli/azd/pkg/ai/model_service_test.go | Updates test imports to /v2. |
| cli/azd/pkg/ai/model_service_cache_test.go | Updates test imports to /v2. |
| cli/azd/pkg/ai/model_helpers_test.go | Updates test imports to /v2. |
| cli/azd/pkg/ai/deprecation_helpers_test.go | Updates test imports to /v2. |
| cli/azd/extensions/microsoft.azd.ai.builder/internal/pkg/azure/ai/model_catalog.go | Updates Cognitive Services SDK import to /v2 to keep the module buildable after the dependency bump. |
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
|
/check-enforcer override |

azd downfails when purging Foundry cognitive accounts because thearmcognitiveservices v1.8.0SDK modelsnetworkInjectionsas a single object, while the API now returns an array:This is the same SDK gap already addressed in the agents extension (#6957); this brings the fix to azd core.
Changes
armcognitiveservices v1.8.0→armcognitiveservices/v2 v2.0.0incli/azd/go.mod/go.sum. v2 models the field asNetworkInjections []*NetworkInjection, matching the API response..../armcognitiveservices→.../armcognitiveservices/v2) across the consuming packages:pkg/azapi/cognitive_service.gopkg/ai/model_service.gopkg/infra/provisioning/bicep/bicep_provider.go(theazd downpurge path)extensions/microsoft.azd.ai.builder/.../model_catalog.go— part of thecli/azdmodule, updated sogo mod tidycould drop the v1 dependency.The v2 package name is unchanged and all consumed types/clients (
AccountsClient,DeletedAccountsClient,Account,Model,Usage, …) are source-compatible; only the module path moved.With and without change