{"id":20704,"date":"2025-03-12T10:00:43","date_gmt":"2025-03-12T18:00:43","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/powershell\/?p=20704"},"modified":"2025-03-12T10:00:43","modified_gmt":"2025-03-12T18:00:43","slug":"enhanced-authoring-with-dsc-v3","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/enhanced-authoring-with-dsc-v3\/","title":{"rendered":"Authoring Enhancements in Microsoft Desired State Configuration v3.0.0"},"content":{"rendered":"<p><em>This is the third post in a multi-part series about the new release of DSC.<\/em><\/p>\n<p><strong>Microsoft Desired State Configuration (DSC) v3.0.0<\/strong> provides powerful feature that enhance the authoring experience.<\/p>\n<ul>\n<li>Shell completion<\/li>\n<li>Schema-based validation<\/li>\n<li>Support for modern DSLs like Azure Bicep<\/li>\n<\/ul>\n<p><div class=\"alert alert-success\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Lightbulb\"><\/i><strong>TIP<\/strong><\/p><\/p>\n<p>This post uses the following terminology:<\/p>\n<ul>\n<li><b>DSC<\/b> refers to Desired State Configuration (DSC) v3.0.0.<\/li>\n<li><b>PSDSC<\/b> refers to PowerShell Desired State Configuration (PSDSC) v1.1 and v2.<\/li>\n<\/ul>\n<p><\/div><\/p>\n<h2>DSC command completer<\/h2>\n<p>The completer command returns a shell script that, when executed, registers completions for the\ngiven shell.<\/p>\n<p>DSC can generate completion scripts for the following shells:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.gnu.org\/software\/bash\/\">Bash<\/a><\/li>\n<li><a href=\"https:\/\/elv.sh\/\">Elvish<\/a><\/li>\n<li><a href=\"https:\/\/fishshell.com\/\">Fish<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/powershell\/scripting\/overview\">PowerShell<\/a><\/li>\n<li><a href=\"https:\/\/support.apple.com\/102360\">Z Shell<\/a><\/li>\n<\/ul>\n<p>To learn more, see <a href=\"https:\/\/learn.microsoft.com\/powershell\/dsc\/reference\/cli\/completer\/command?view=dsc-3.0&amp;preserveView=true\">the <code>dsc completer<\/code> command reference documentation<\/a>.<\/p>\n<h2>Enhanced Authoring with Schemas<\/h2>\n<p>Working with DSC platform involves writing configuration documents and resource manifests. DSC\nvalidates these data files using a JSON schema. While the DSC schemas are useful for authoring, DSC\nalso includes a set of enhanced schemas for authoring the files in VS Code.<\/p>\n<p>These schemas define extra keywords specific to VS Code that:<\/p>\n<ul>\n<li>Improve the contextual help when hovering on or selecting a property in the data file.<\/li>\n<li>Add contextual help for enum values.<\/li>\n<li>Improve the error messages for invalid values.<\/li>\n<li>Add default snippets to autocomplete values.<\/li>\n<\/ul>\n<p>To learn more, see <a href=\"https:\/\/learn.microsoft.com\/powershell\/dsc\/concepts\/enhanced-authoring?view=dsc-3.0&amp;preserveView=true\">Authoring with Enhanced Schemas<\/a>.<\/p>\n<h2>Authoring with Bicep (Coming soon!)<\/h2>\n<p><a href=\"https:\/\/learn.microsoft.com\/azure\/azure-resource-manager\/bicep\/overview?tabs=bicep\">Bicep<\/a> is Microsoft&#8217;s domain specific language (DSL) for creating declarative Azure Resource\nManager (ARM) deployments. It offers a clean, intuitive syntax that makes writing and maintaining\nDSC configurations more efficient. By using Bicep as a DSL, DSC users enjoy the benefits of strong\nvalidation, modularity, and seamless integration with Azure-native tooling, without the complexity\nof authoring in JSON or YAML.<\/p>\n<p>You can write and invoke Bicep configurations locally&#8211;without access to Azure&#8211;or as part of\nyour Azure deployments, combining Infrastructure as code (IaC) and Configuration as code (CaC).<\/p>\n<p>The following Bicep configuration document calls the classic PowerShell resource <code>WindowsFeature<\/code>\nfrom the <strong>PSDesiredStateConfiguration<\/strong> module to install the IIS web server feature on Windows\nServer.<\/p>\n<pre><code class=\"language-bicep\">targetScope = 'dsc'\r\nresource powershellAdapter 'Microsoft.Windows\/WindowsPowerShell@2025-01-07' = {\r\n  name: 'Web server install'\r\n  properties: {\r\n    resources: [\r\n      {\r\n        name: 'Run WindowsFeature'\r\n        type: 'PSDesiredStateConfiguration\/WindowsFeature'\r\n        properties: {\r\n          Name: 'Web-server'\r\n          Ensure: 'Present'\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}<\/code><\/pre>\n<p>By default, a Bicep file is scoped to a Bicep resource. To use Bicep with DSC, you must set the\nscope to <code>dsc<\/code>. Bicep support is still being developed. We&#8217;ll make an announcement when Bicep\nsupport and documentation is available.<\/p>\n<h2>Call to action<\/h2>\n<p>For more information about DSC v3.0, see the <a href=\"https:\/\/learn.microsoft.com\/powershell\/dsc\/overview?view=dsc-3.0&amp;preserveView=true\">DSCv3 documentation<\/a>. We value your feedback. Stop\nby our <a href=\"https:\/\/github.com\/PowerShell\/DSC\">GitHub repository<\/a> and let us know of any issues you find.<\/p>\n<p>Jason Helmick<\/p>\n<p>Sr. Product Manager, PowerShell<\/p>\n<p><!-- link references --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the third post in a multi-part series about the new release of DSC. Microsoft Desired State Configuration (DSC) v3.0.0 provides powerful feature that enhance the authoring experience. Shell completion Schema-based validation Support for modern DSLs like Azure Bicep DSC command completer The completer command returns a shell script that, when executed, registers completions [&hellip;]<\/p>\n","protected":false},"author":7527,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[3197],"class_list":["post-20704","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-powershell-dsc"],"acf":[],"blog_post_summary":"<p>This is the third post in a multi-part series about the new release of DSC. Microsoft Desired State Configuration (DSC) v3.0.0 provides powerful feature that enhance the authoring experience. Shell completion Schema-based validation Support for modern DSLs like Azure Bicep DSC command completer The completer command returns a shell script that, when executed, registers completions [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/7527"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=20704"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/20704\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=20704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=20704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=20704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}