-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Bicep version
0.36.177
Describe the bug
The specification describes the optional parameter networkInjections
as an object; however, the underlying ARM REST API expects that networkInjections
parameter to be an array of items. This type difference is causing the following exception:
The 'properties' field is invalid, error: 'Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List1[Microsoft.CognitiveServices.ResourceProvider.Contracts.NetworkInjection]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To 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<T>) 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.
Path 'networkInjections.scenario'.'. (Code:InvalidResourceProperties)
The Bicep and ARM API specifications and documentation should be in sync.
To Reproduce
Steps to reproduce the behavior:
Attempt to create a Microsoft.CognitiveServices/account
resource and supply an object value for networkInjections
.
resource cognitiveService 'Microsoft.CognitiveServices/accounts@2025-06-01' = {
name: uniqueString(subscription().subscriptionId, resourceGroup().name, 'cognitiveService')
kind: 'AIServices'
location: 'australiaeast'
sku: {
name: 'S0'
}
properties: {
networkInjections: {
scenario: 'agents'
subnetArmId: network.subnetResourceId
useMicrosoftManagedNetwork: false
}
publicNetworkAccess: 'Enabled'
}
}
Additional context
Related issue on the api specs repository: Azure/azure-rest-api-specs#35699
A workaround exists where the user can provide an array to networkInjections
instead of an object. A warning is presented which can also be disabled:
resource cognitiveService 'Microsoft.CognitiveServices/accounts@2025-06-01' = {
name: uniqueString(subscription().subscriptionId, resourceGroup().name, 'cognitiveService')
kind: 'AIServices'
location: 'australiaeast'
sku: {
name: 'S0'
}
properties: {
#disable-next-line BCP036
networkInjections: [
{
scenario: 'agents'
subnetArmId: network.subnetResourceId
useMicrosoftManagedNetwork: false
}]
publicNetworkAccess: 'Enabled'
}
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status