Template schema not supported for targetScope = 'desiredStateConfiguration'
Bicep version
Bicep CLI version 0.34.48 (e4324d410e) from #16685 ( artifact feed )
Describe the bug After enabling the experimental feature for DSC and adding the file to Azure Portal, a "Template schema not supported"-error occurs during validation.
To Reproduce
-
enable the desiredStateConfiguration experimental feature in
bicepconfig.json, -
build an example Bicep
dsc.bicepfile using thetargetScope = 'desiredStateConfiguration' -
open Azure Portal's 'Deploy a custom template'-service, select the
dsc.jsontemplate, and try to validate{"code":"InvalidTemplate","message":"Deployment template validation failed: 'Template schema 'https://aka.ms/dsc/schemas/v3/bundled/config/document.json' is not supported. Supported versions are '2014-04-01-preview,2015-01-01,2018-05-01,2019-04-01,2019-08-01'. Please see https://aka.ms/arm-syntax for usage details.'."}
Additional context
Goal is to move from PSDSC to DSC. Probably I'm overlooking something basic, but what could it be?
Recently, in #16389 this was added as an experimental feature, and in #16685 the schema was changed.
Example file bicepconfig.json
{
"experimentalFeaturesEnabled": {
"desiredStateConfiguration": true
}
}
Example file dsc.bicep
targetScope = 'desiredStateConfiguration'
resource powershellAdapter 'Microsoft.Windows/WindowsPowerShell@2025-01-07' = {
name: 'Run WinPS script'
properties: {
resources: [
{
name: 'Run script'
type: 'PSDesiredStateConfiguration/Script'
properties: {
Name: 'ComputerManagementDsc'
IsSingleInstance: 'Yes'
TimeZone: 'W. Europe Standard Time'
}
}
]
}
}
Example file dsc.json
{
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/config/document.json",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.34.48.58418",
"templateHash": "5123182227474300147"
}
},
"resources": [
{
"type": "Microsoft.Windows/WindowsPowerShell",
"apiVersion": "2025-01-07",
"name": "Run WinPS script",
"properties": {
"resources": [
{
"name": "Run script",
"type": "PSDesiredStateConfiguration/Script",
"properties": {
"Name": "ComputerManagementDsc",
"IsSingleInstance": "Yes",
"TimeZone": "W. Europe Standard Time"
}
}
]
}
}
]
}
There are multiple issues with your DSC configuration:
PSDesiredStateConfiguration/Scriptis for running raw PowerShell, but you are trying to use a DSC resource from theComputerManagementDscpackage.- You need to specify the
TimeZoneresource from theComputerManagementDscpackage if that's what you want to execute.
targetScope = 'desiredStateConfiguration'
resource powershellAdapter 'Microsoft.Windows/WindowsPowerShell@2025-01-07' = {
name: 'Run WinPS script'
properties: {
resources: [
{
name: 'Set Time Zone'
type: 'ComputerManagementDsc/TimeZone'
properties: {
IsSingleInstance: 'Yes'
TimeZone: 'W. Europe Standard Time'
}
}
]
}
}
Your error doesn't relate to these issues (unless it's a red herring), but I thought I'd mention it anyway. You mention you're trying to add the file to the Azure Portal, but you haven't specified what you're trying to do. If you are trying to add a DSC v3 file for Azure Machine Configuration, you should know that's not supported for Windows.
fyi @andyleejordan @theJasonHelmick @mgreenegit
@m-mrks Thanks for trying out the new experimental Bicep support for targetScope = 'desiredStateConfiguration' — and for reporting this issue! Bicep-based DSC configurations are under active development, support for your scenario is expected. Currently, we are planning to extend Bicep support during our development of DSC 3.2.0 - which is underway. I don't have a timeline, but I'm thinking by the end of the year. You can follow the DSC v3 project here: https://github.com/PowerShell/DSC