Azure / Azure/azure-rest-api-specs
[BUG] Cognitive account's networkInjection definition is not correct
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 424
Description
### API Spec link
https://github.com/Azure/azure-rest-api-specs/blob/6c548b0bd279f5e233661b1c81fb5b61b19965cd/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2025-04-01-preview/cognitiveservices.json#L8813
### API Spec version
2025-04-01-preview
### Describe the bug
In the API spec, the `networkInjection` should be an object. But the API requires it to be an array of objects.
### Expected behavior
The API should be consistent with the API spec.
### Actual behavior
In the API spec, the `networkInjection` should be an object. But the API requires it to be an array of objects.
### Reproduction Steps
#####
11:47:55 PUT management.azure.com /subscriptions/00000/resourceGroups/henglu77/providers/Microsoft.CognitiveServices/accounts/ai-sandbox-reference-deployment-02?api-version=2025-04-01-preview 400
Request
| Header | Value |
| ----- | ----- |
| Authorization | REDACTED |
| Content-Length | 551 |
| Content-Type | application/json |
| User-Agent | HashiCorp Terraform/1.12.2 (+https://www.terraform.io) terraform-provider-azapi/dev pid-222c6c49-1b0a-5959-a213-6608f9eb8820 |
| X-Ms-Correlation-Request-Id | 57c2aa64-9a39-c52f-4108-599195419968 |
| Accept | application/json |Request Body:
```json
{
"identity": {
"type": "SystemAssigned"
},
"kind": "AIServices",
"location": "eastus",
"properties": {
"customSubDomainName": "ai-sandbox-reference-deployment-02",
"disableLocalAuth": false,
"networkAcls": {
"defaultAction": "Allow",
"ipRules": [],
"virtualNetworkRules": []
},
"networkInjections": {
"scenario": "agent",
"subnetArmId": "/subscriptions/00000/resourceGroups/henglu77/providers/Microsoft.Network/virtualNetworks/vnet-henglu77/subnets/Subnet-1",
"useMicrosoftManagedNetwork": false
},
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "S0"
}
}
```Response
**Response Status: 400 Bad Request**
| Header | Value |
| ----- | ----- |
| X-Ms-Correlation-Request-Id | 57c2aa64-9a39-c52f-4108-599195419968 |
| X-Ms-Operation-Identifier | appId=06e00f79-5059-418e-9648-f60a13302591,tenantId=213e87ed-8e08-4eb4-a63c-c073058f7b00,objectId=d1132398-0f30-4db5-89bb-899b3cea92df/southeastasia/35571edb-c0b4-4a64-a96f-3d762a7625fe |
| Content-Length | 779 |
| Expires | -1 |
| X-Envoy-Upstream-Service-Time | 34 |
| X-Ms-Ratelimit-Remaining-Subscription-Global-Writes | 2999 |
| X-Ms-Routing-Request-Id | SOUTHEASTASIA:20250707T034755Z:0d0c06e2-c529-428f-9021-e3405d3df9bd |
| Content-Type | application/json; charset=utf-8 |
| Date | Mon, 07 Jul 2025 03:47:54 GMT |
| Pragma | no-cache |
| X-Content-Type-Options | nosniff |
| X-Ms-Ratelimit-Remaining-Subscription-Writes | 199 |
| X-Ms-Request-Id | dc855a03-54d2-495f-b7f1-edfdc06850d8 |
| Cache-Control | no-cache |
| Strict-Transport-Security | max-age=31536000; includeSubDomains |
| X-Cache | CONFIG_NOCACHE |
| X-Msedge-Ref | Ref A: 826D3949C3DC4646BC53BD37AE7F5E04 Ref B: MAA201060515023 Ref C: 2025-07-07T03:47:48Z |Response Body:
```json
{
"error": {
"code": "InvalidResourceProperties",
"message": "The 'properties' field is invalid, error: 'Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.List`1[Microsoft.CognitiveServices.ResourceProvider.Contracts.NetworkInjection]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List\u003cT\u003e) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\nPath 'networkInjections.scenario'.'."
}
}
```
-----
#####
11:50:30 PUT management.azure.com /subscriptions/00000/resourceGroups/henglu77/providers/Microsoft.CognitiveServices/accounts/ai-sandbox-reference-deployment-03?api-version=2025-04-01-preview 201
Request
| Header | Value |
| ----- | ----- |
| Accept | application/json |
| Authorization | REDACTED |
| Content-Length | 553 |
| Content-Type | application/json |
| User-Agent | HashiCorp Terraform/1.12.2 (+https://www.terraform.io) terraform-provider-azapi/dev pid-222c6c49-1b0a-5959-a213-6608f9eb8820 |
| X-Ms-Correlation-Request-Id | 28773e90-1396-47b3-2f3a-0047f3f15d0c |Request Body:
```json
{
"identity": {
"type": "SystemAssigned"
},
"kind": "AIServices",
"location": "eastus",
"properties": {
"customSubDomainName": "ai-sandbox-reference-deployment-03",
"disableLocalAuth": false,
"networkAcls": {
"defaultAction": "Allow",
"ipRules": [],
"virtualNetworkRules": []
},
"networkInjections": [
{
"scenario": "agent",
"subnetArmId": "/subscriptions/00000/resourceGroups/henglu77/providers/Microsoft.Network/virtualNetworks/vnet-henglu77/subnets/Subnet-1",
"useMicrosoftManagedNetwork": false
}
],
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "S0"
}
}
```Response
**Response Status: 201 Created**
| Header | Value |
| ----- | ----- |
| Pragma | no-cache |
| Strict-Transport-Security | max-age=31536000; includeSubDomains |
| X-Cache | CONFIG_NOCACHE |
| X-Envoy-Upstream-Service-Time | 6529 |
| Cache-Control | no-cache |
| Content-Type | application/json; charset=utf-8 |
| X-Ms-Request-Id | c39268e5-4aff-41cd-92d1-a13ac4ddf407 |
| X-Ms-Routing-Request-Id | SOUTHEASTASIA:20250707T035030Z:34a3bb8b-08b7-45ba-804f-06e8fd0c499d |
| X-Msedge-Ref | Ref A: 997D9C65F0EB4F6C8357C65BB28FFF6E Ref B: MAA201060516009 Ref C: 2025-07-07T03:50:19Z |
| Date | Mon, 07 Jul 2025 03:50:29 GMT |
| Etag | "1300f0f2-0000-0100-0000-686b44050000" |
| Expires | -1 |
| X-Ms-Correlation-Request-Id | 28773e90-1396-47b3-2f3a-0047f3f15d0c |
| X-Ms-Ratelimit-Remaining-Subscription-Writes | 199 |
| Content-Length | 34354 |
| X-Content-Type-Options | nosniff |
| X-Ms-Operation-Identifier | appId=06e00f79-5059-418e-9648-f60a13302591,tenantId=213e87ed-8e08-4eb4-a63c-c073058f7b00,objectId=d1132398-0f30-4db5-89bb-899b3cea92df/southeastasia/8c849c19-c452-4e05-88a6-b80af1ed4680 |
| X-Ms-Ratelimit-Remaining-Subscription-Global-Writes | 2999 |Response Body:
```json
{
"etag": "\"1300f0f2-0000-0100-0000-686b44050000\"",
"id": "/subscriptions/00000/resourceGroups/henglu77/providers/Microsoft.CognitiveServices/accounts/ai-sandbox-reference-deployment-03",
"identity": {
"principalId": "d5c053cd-7650-47ea-aac6-4da58cd9453a",
"tenantId": "213e87ed-8e08-4eb4-a63c-c073058f7b00",
"type": "SystemAssigned"
},
"kind": "AIServices",
"location": "eastus",
"name": "ai-sandbox-reference-deployment-03",
"properties": {
"allowProjectManagement": false,
"apiProperties": {
"qnaAzureSearchEndpointKey": null
},
"customSubDomainName": "ai-sandbox-reference-deployment-03",
"dateCreated": "2025-07-07T03:50:25.3900958Z",
"disableLocalAuth": false,
"endpoint": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"endpoints": {
"AI Foundry API": "https://ai-sandbox-reference-deployment-03.services.ai.azure.com/",
"Azure AI Model Inference API": "https://ai-sandbox-reference-deployment-03.services.ai.azure.com/",
"Cohere AI API": "https://ai-sandbox-reference-deployment-03.services.ai.azure.com/",
"Computer Vision": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Container": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Content Safety": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Content Understanding": "https://ai-sandbox-reference-deployment-03.services.ai.azure.com/",
"Conversational Language Understanding Authoring": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"ConversationalLURuntime": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Custom Question Answering": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Custom Question Answering Authoring": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Custom Text Authoring": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"CustomTranslator": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"DocumentTranslation": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"FormRecognizer": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"LUIS": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Language": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Mistral AI API": "https://ai-sandbox-reference-deployment-03.services.ai.azure.com/",
"OpenAI Dall-E API": "https://ai-sandbox-reference-deployment-03.openai.azure.com/",
"OpenAI Language Model Instance API": "https://ai-sandbox-reference-deployment-03.openai.azure.com/",
"OpenAI Model Scaleset API": "https://ai-sandbox-reference-deployment-03.openai.azure.com/",
"OpenAI Moderations API": "https://ai-sandbox-reference-deployment-03.openai.azure.com/",
"OpenAI Realtime API": "https://ai-sandbox-reference-deployment-03.openai.azure.com/",
"OpenAI Sora API": "https://ai-sandbox-reference-deployment-03.openai.azure.com/",
"OpenAI Whisper API": "https://ai-sandbox-reference-deployment-03.openai.azure.com/",
"QnAMaker": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"QuestionAnswering": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Audio Content Creation": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Batch Avatar": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Batch Text to Speech": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Custom Avatar": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Custom Voice": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Custom Voice Trial": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Speaker Identification": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Speaker Verification": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Speech to Text": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Speech to Text (Standard)": "https://eastus.stt.speech.microsoft.com",
"Speech Services Speech to Text 2024-05-15-preview": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Speech to Text 2024-11-15": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Speech to Text v3.2": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Speech to Text v3.2_internal.1": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Speech Services Text to Speech (Neural)": "https://eastus.tts.speech.microsoft.com",
"Text Analytics": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"TextTranslation": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"TextTranslation-Global": "https://api.cognitive.microsofttranslator.com/",
"Token": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Token Service API": "https://ai-sandbox-reference-deployment-03.openai.azure.com/",
"Turing": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Video Translation": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Voice Agent Realtime API": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/",
"Voice Live Realtime API": "https://ai-sandbox-reference-deployment-03.cognitiveservices.azure.com/"
},
"internalId": "4da1ecafe8b14062b074366776936ea2",
"isMigrated": false,
"networkAcls": {
"defaultAction": "Allow",
"ipRules": [],
"virtualNetworkRules": []
},
"networkInjections": [
{
"scenario": "agent",
"subnetArmId": "/subscriptions/00000/resourceGroups/henglu77/providers/Microsoft.Network/virtualNetworks/vnet-henglu77/subnets/Subnet-1",
"useMicrosoftManagedNetwork": false
}
],
"privateEndpointConnections": [],
"provisioningState": "Creating",
"publicNetworkAccess": "Disabled"
},
"sku": {
"name": "S0"
},
"systemData": {
"createdAt": "2025-07-07T03:50:21.6648091Z",
"createdBy": "06e00f79-5059-418e-9648-f60a13302591",
"createdByType": "Application",
"lastModifiedAt": "2025-07-07T03:50:21.6648091Z",
"lastModifiedBy": "06e00f79-5059-418e-9648-f60a13302591",
"lastModifiedByType": "Application"
},
"type": "Microsoft.CognitiveServices/accounts"
}
```
-----
### Environment
_No response_
Contributor guide
Research direction
Start at the linked cognitiveservices.json definition around line 8813 and compare its networkInjections shape with the successful and failed request bodies in this issue. Confirm the intended array-versus-object contract for API version 2025-04-01-preview, then update the specification so it matches the service behavior and validate the generated API definition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100