版本发布 8
## Highlights * Snapshot command is GA (#19084) Example usage: ```sh # capture a snapshot bicep snapshot main.bicepparam # validate a snapshot bicep snapshot main.bicepparam --mode validate # capture a snapshot with Azure context bicep snapshot main.bicepparam --subscription-id 3faf6056-8474-4818-a729-1aff55d6b3fa --resource-group myRg --location westus --mode overwrite ``` Walkthrough [YouTube - Bicep Snapshot Demo](https://www.youtube.com/watch?v=84jVnQI-0Ak) Official docs coming soon. In the meantime, see [Using the snapshot command](https://github.com/Azure/bicep/blob/v0.41.2/docs/experimental/snapshot-command.md). * [Experimental] `@nullIfNotFound()` decorator for `existing` resources (#18697) Basic example: ```bicep @nullIfNotFound() resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' existing = { name: 'testStorage' } output safeLocation string? = storageAccount.?location output safeSkuName string? = storageAccount.?sku.name output safeAccessTier string? = storageAccount.?properties.accessTier output locationWithDefault string = storageAccount.?location ?? 'westus' output skuNameWithDefault string = storageAccount.?sku.name ?? 'Standard_LRS' output accessTierWithDefault string = storageAccount.?properties.accessTier ?? 'Hot' ``` ## Bug Fixes and Features * Add MCP server metadata JSON file to NuGet package (#18909) * Add section on comments to Best Practices doc (#18913) * Fix nested extendable params spread: ensure inherited spread expressions are bound correctly (#19028) * add support for array splat completion in type syntax and enhance completion context (#18948) * Add completions for `#disable-diagnostics` and `#restore-diagnostics` (#18919) * Add extension namespace functions (#18910) * [PublishExtension command] Ensure namespace functions are considered when building types archive (#18999) * Use file handle URI in output (#18920) * [Experimental] Visualizer V2 (#18986, #18987, #18992, #18995, #19025, #19029, #19080) ## Community Contributions * Minor typos in README.md (#19079) - thanks @gerbermarco ! * Enhance snapshot command documentation (#18959) - thanks @verschaevesiebe ! * Add snapshot command help documentation to RootCommand (#18988) - thanks @verschaevesiebe !
## Highlights * Multi-line interpolated strings GA! (#18666) Basic example: ```bicep var s = $''' this is ${interpolated}''' ``` With multiple `$` characters: ```bicep var s = $$''' this is $${interpolated} this is not ${interpolated}''' ``` * [Experimental] New `this.exists()` and `this.existingResource()` functions for resource existence checks (#17727) Example usage: ```bicep resource storageAccount 'Microsoft.Storage/storageAccounts@2021-09-01' = { name: 'mystorageaccount' location: 'eastus' sku: { name: 'Standard_LRS' } kind: 'StorageV2' properties: { minimumTlsVersion: 'TLS1_2' publicNetworkAccess: this.exists() ? 'Enabled' : 'Disabled' } } ``` * New MCP Server tools (#18707, #18826) * `decompile_arm_parameters_file`: Converts ARM template parameter JSON files into Bicep parameters format (.bicepparam). * `decompile_arm_template_file`: Converts ARM template JSON files into Bicep syntax (.bicep). * `format_bicep_file`: Applies consistent formatting (indentation, spacing, line breaks) to Bicep files. * `get_bicep_file_diagnostics`: Analyzes a Bicep file and returns all compilation diagnostics. * `get_file_references`: Analyzes a Bicep file and returns a list of all referenced files including modules, parameter files, and other dependencies. * `get_deployment_snapshot`: Creates a deployment snapshot from a .bicepparam file by compiling and pre-expanding the ARM template, allowing you to preview predicted resources and perform semantic diffs between Bicep implementations. * Publish Bicep MCP server as a nuget package (#18709) Example `mcp.json` configuration: ```json { "servers": { "Bicep": { "type": "stdio", "command": "dnx", "args": [ "Azure.Bicep.McpServer", "--yes" ] } } } ``` * `bicep console`: Support piping and stdin/out redirection (#18762) Example with piping: ```sh echo "parseCidr('10.144.0.0/20')" | bicep console ``` Example with input redirection: ```sh echo "parseCidr('10.144.0.0/20')" > test.txt bicep console < test.txt ``` Example with output redirection: ```sh echo "parseCidr('10.144.0.0/20')" | bicep console > output.json ``` * Extendable Parameter Files Improvements: * Enable parameter files to evaluate variables from extended base parameters (#18626) * Add support for `loadTextContent` function in extendable parameter files (#18424) * Multiline diagnostic pragmas (#18622) Disable a specific diagnostic for a whole file: ```bicep #disable-diagnostics BCP422 ... resource foo 'type@version' = if (condition) {} output bar string = foo.properties.bar // <-- would normally raise BCP422 as a warning, but will not due to pragma at top of file ``` Disable specific diagnostics for a span: ```bicep resource foo 'type@version' = if (condition) {} #disable-diagnostics BCP422 output bar string = foo.properties.bar // <-- would normally raise BCP422 as a warning, but will not due to pragma at top of file #restore-diagnostics BCP422 output baz string = foo.properties.baz // <-- will raise BCP422 warning because it's outside of the pragma fence ``` * Migrate to .NET 10 (#18458) ## Bug Fixes and Features * Use integer and boolean literal types when deriving return type for `loadJsonContent` (#18466) * Update `deployment()` return type signature to add conditional `metadata` property (#18468) * Recognize `<collection module>[<index>]!` as a direct module reference for secure outputs check (#18522) * Extension config default values constraint fixes (#18606) * Update lv 2.0 triggers to take syntactically nested resources into account (#18607) * Making the scope property a fully qualified resource Id (#18165) * Expand support for types in local extension (#18662) * Improved extension configuration experience (#18828) * Fix handling registry module resource derived types in params file (#18661) * Fix completion to correctly suggest imported types in bicepparam files (#18523) * Fix quoted property names and enhance symbol resolution (#18509) * Fix nested function calls losing bindings when using extendable parameters (#18876) * Always use named pipes on Windows for gRPC (#18712) * Remove DSC experimental feature (#18821) * Simplify YAML/JSON parser code path with Result pattern (#18713) * Refactor external inputs processing logic to use `InlineDependencyVisitor` and dedicated `FunctionFlag` (#18740) * Update CSAT survey to be always on instead of annual (#18657) ## Documentation * Add troubleshooting steps for MCP tools not showing (#18563) * Revise Bicep MCP Server Docs (#18699) * Revise local deploy debugging guide for Bicep extensions (#18701) * Add unit testing guide for Bicep extensions (#18702) * Add beginner tip to Bicep getting started section (#18706) * Improve documentation for extendable parameter files (#18656) * Add bicep local-deploy arguments table docs (#18788) ## Community Contributions * E2E Tests for playground with playwright (#18521) - thanks @ShpendKe ! * Add: bicep local-deploy arguments table docs (#18788) - thanks @johnlokerse ! * Add beginner tip to Bicep getting started section (#18706) - @JennyCloud ! * Fix grammar in codebase documentation (#18768) - thanks @JennyCloud !
## Bug Fixes * Fix for incorrect error diagnostic on policyDefinitions existing resource usage (#18169) * Fix regression on secure inline object types and resource-derived string and object types (#18170) * Bicep.RpcClient - use PipeReader & PipeWriter APIs (#18212)
## Highlights * onlyIfNotExists GA! (#17996) ```bicep @onlyIfNotExists() resource onlyDeployIfNotExists 'Microsoft...' = { name: 'example' location: 'eastus' properties: { ... } } ``` * **[Experimental]** Interactive `bicep console` command for REPL functionaltiy (#18152) See [Using the Console Command](https://github.com/Azure/bicep/blob/main/docs/experimental/console-command.md) for additional information. * **[Experimental]** Interactive `bicep deploy`, `bicep what-if` and `bicep teardown` commands (#18041, #18052, #18053, #18096, #18104) https://github.com/user-attachments/assets/da64f3a3-3c11-411b-94b6-6324f79af107 See [Using the Deploy Commands](https://github.com/Azure/bicep/blob/main/docs/experimental/deploy-commands.md) for additional information and code samples. * **[Experimental]** Add `@validate()` decorator for custom validation (#17804) - requires the `userDefinedConstraints` feature flag ```bicep @validate(x => startsWith(x, 'foo')) // <-- Accepts 'food' or 'fool' but causes the deployment to fail if 'booed' was supplied param p string ``` * Add loadDirectoryFileInfo function (#17241) - thanks @GABRIELNGBTUC ! This function returns an array of objects for each file in the directory for you to use in your Bicep template. ```bicep var directoryInfo = loadDirectoryFileInfo('./directory') var directoryInfoWildcard = loadDirectoryFileInfo('./directory', '*.txt') ``` * Add an explicit `any` type (#17848) This PR adds a new ambient type symbol (`any`) to take advantage of "type" constraints being made optional in ARM's w34 release. Anywhere type syntax is expected, users can now supply `any`: ```bicep param foo any output bar any = foo func cowSay(toSay any) string => 'The cow says, "${toSay}"' ``` * Remove `moduleIdentity` experimental feature (#17909) ```bicep module mod './module.bicep' = { identity: { type: 'UserAssigned' userAssignedIdentities: { '${mid.id}': {} } } } ``` ## Bug Fixes and Features * Bicep MCP server * Updated mcp experimental docs to show EXPERIMENTAL server name (#17754) * Add List AVM MCP Tool (#17845) * fixing typos in mcp server best practices file (#17855) * Bicepparam * Remove redundant checks for empty parameter assignments in parameter evaluation (#17807) * fix and add test for invalid parameter type (#17193) * implement "base" parameters support for extended bicepparam files (#17850) * Fix a bug where source files with extensions cannot be published (#17808) * Check for Windows Style Absolute Paths (#17995) * Add `experimentalFeaturesWarning` (#17910) * Add "Creating a Local Extension with .NET" quickstart guide (#17726) * Graph extension update dynamic types link (#17851) * Automatically enable symbolic name compilation for resource/module collection access (#17861) * [docs] Add information about trace verbosity (#18093) * Do not require properties marked as readonly+required (#17913) * Add & handle `readableScopes` + `writableScopes` properties (#17849) * Inline existing resources with runtime names (#17904) * Bug fixes for moduleExtensionConfigs experimental feature. (#17860) * Fix quickstart instructions (#17759) * Fix broken local-deploy links (#17846) * Increase local deploy job timeout (#18040) * Avoid returning internal information for extensible resource snapshot (#18119) ## Community Contributions * feat: BRM Tool - Removed deprecated `pathFilter` property from BRM version schema (#17720) - thanks @AlexanderSehr ! * Add fix to decompile desiredStateConfiguration resources (#17764) - thanks @Gijsreyn ! * Fix bicep decompile-params if file is different name (#17795) - thanks @Gijsreyn ! * Linter rule should exclude all metadata (#17667) - thanks @guimatheus92 !
## Highlights * **[Experimental]** Bicep MCP server (#17519, #17572, #17607, #17712). See [Using Bicep MCP Server in VS Code (Preview!)](https://github.com/Azure/bicep/blob/main/docs/experimental/mcp-tools.md) for usage information. * **[Experimental]** Simplified C# authoring experience for [Local Deploy](https://github.com/Azure/bicep/blob/main/docs/experimental/local-deploy.md) extensions (#17557, #17616) - thanks @samirbanjanovic ! * GA release for the `externalInput()` function (#17470) * **[Requires the `localDeploy` [Experimental feature](https://github.com/Azure/bicep/blob/main/docs/experimental-features.md)]** Simplify publishing process by supporting type discovery via gRPC (#17665) * Add "format" capability to `bicep jsonrpc` (#17567) * **[Requires the `moduleExtensionConfigs` [Experimental feature](https://github.com/Azure/bicep/blob/main/docs/experimental-features.md)]** Extension config assignment syntax updates and module aware extension config assignment (#17389) ## Bugs and Features * Use language version 2.0 for extensibility (#17714) * Update short-circuiting linter to use nested deployment expander (#17334) * Emit an error diagnostic when a secure output is dereferenced indirectly (#17453) * Improve `reduce` type inference (#17574) * Add stacks extensibility linting rule. Restrict syntax on config assignments. (#17654) * Add control bar for visual designer (#17518) * Remove deprecated CLI arguments (#17564) ## Community Contributions * Update params-file-grammar.md (#17510) - thanks @rgant ! * Add linter rule to warn on usage of outdated AzPowerShell version in deployment scripts (#17556) - thanks @guimatheus92 ! * Added references to the Azure Verified Module website and bicep-registry-module repository (#17664) - thanks @johnlokerse !
## Highlights * Add Identity Snippets for Resources (#17335) * Update Bicep linter diagnostics to point to https://aka.ms/bicep/linter-diagnostics (#17390) * Mark conditional resources as nullable for the purposes of property access (#16987) * Typing improvements for extensions (#17242) ## Features and Bug Fixes * Handle union type properly in use-secure-value-for-secure-inputs rule (#17372) * Update Azure.Deployments.Templates to latest (#17375) * Fix extension collection reference codegen (#17381) * Detect usage of fully-qualified non-deterministic functions in resource identifiers (#17505) * Remove auxiliary file size limit for local deploy (#17506) * Add (WIP) visual designer and resource type explorer apps (#17503) * Add DeployTimeConstant Flag for Module Identity (#17383) * Support ES target for highlight.js (#17285) * Only use `listOutputsWithSecureValues` to dereference secure outputs (#17423) ### Snapshot command * Add support for null-valued parameters to snapshot command (#17291) * Use the target scope of the template file as the target scope of a params file (#17292) * Surface cross-module validation errors in snapshot command as messages, not unhandled exceptions (#17378) * Enable speculative reference evaluation in snapshot helper (#17512) ## Community Contributions * Correct Param & Var Declarations (#17511) - thanks @rgant ! * Add Dependabot configuration for .NET SDK updates (#17424) - thanks @JamieMagee ! * Type definition code base and associated unit tests (#17391) - thanks @samirbanjanovic !
## Highlights * GA release for the `@secure()` decorator on module outputs! You can now output secure values from a child module and read them in a parent module. (#16796) * Visual Studio Bicep extension support for `.bicepparam` files! (#16861) * New functions for working with URIs - `parseUri()` and `buildUri()` (#16802) Example usage: ```bicep /* Returns { scheme: 'https' host: 'example.com' port: 1234 path: '/foo/bar' } */ output parsedUri object = parseUri('https://example.com:1234/foo/bar') /* Returns: 'https://example.com:1234/foo/bar' */ output builtUri string = buildUri({ scheme: 'https' host: 'example.com' port: 1234 path: 'foo/bar' }) ``` * New functions for working with Availaiblity Zones (#16985) * `toLogicalZone()` - converts physical zones to logical zones * `toPhysicalZone()` - converts logical zones to physical zones * Array versions for bulk conversions (toLogicalZones() & toPhysicalZones()) ```bicep var subscriptionId = subscription().subscriptionId var location = 'westus2' /* Returns the physical AZ corresponding to the specified logical AZ in the specified subscription and location. For westus2 location, this will be one of 'westus2-az1', 'westus2-az2', 'westus2-az3' depending on the subscription. */ output singlePhysicalZone string = toPhysicalZone(subscriptionId, location, '1') /* Returns an array of physical AZs corresponding to the specified logical AZs in the specified subscription and location. */ output physicalZones string[] = toPhysicalZones(subscriptionId, location, ['1', '2']) /* Returns the logical AZ corresponding to the specified physical AZ in the specified subscription and location. Returns '1', '2', or '3' depending on the subscription. */ output singleLogicalZone string = toLogicalZone(subscriptionId, location, 'westus2-az2') /* Returns an array of logical AZs corresponding to the specified physical AZs in the specified subscription and location. */ output logicalZones string[] = toLogicalZones(subscriptionId, location, [ 'westus2-az1' 'westus2-az2' ]) ``` * `use-secure-value-for-secure-inputs` linter rule: Use resource type information to catch more unsafe passing of non-secure values (#16873) * **[requires the `onlyIfNotExists` [experimental feature](https://github.com/Azure/bicep/blob/main/docs/experimental-features.md)]** Resource Existence Checks using `@onlyIfNotExists()` decorator (#16655) Attaching this decorator to a resource declaration means deployment of the resource will only take place if it hasn't already been deployed. Example usage: ```bicep @onlyIfNotExists() resource onlyDeployIfNotExists 'Microsoft...' = { name: 'example' location: 'eastus' properties: { ... } } ``` * **[requires the `typedVariables` [experimental feature](https://github.com/Azure/bicep/blob/main/docs/experimental-features.md)]** Support importing and declaring types in .bicepparam files with typedVariables decorator (#16929) * Allow usage of the type keyword in .bicepparam files * Allow importing types from .bicep files in .bicepparam files * Allow usage of inline types in .bicepparam files * **[requires the `externalInputFunction` [experimental feature](https://github.com/Azure/bicep/blob/main/docs/experimental-features.md)]** External Input function - `externalInput` function to allow reading input that will be resolved later by external tooling in order to inject values at deployment time. (#16726) ## Bugs and Features * Decompiler support for user-defined functions (#16883) * `use-parent-property` linter rule: Fix incorrect warning with blobContainer and fileShare (#16738) * Raise diagnostic for unsupported usage of spread (#16739) * Add friendly name to Playground link (#16803) * Revert #16442 - Fixed bug VSCode extension does not read values from parameter file (#16789) * `no-hardcoded-env-urls` linter rule: Remove URLs not present in `environment()` function output (#16863) * Fix for intellisense of symbols inside import statement (#16936) * fixing `dotnet format` issues, and addressing `IDE0305: Collection initialization can be simplified` errors/warnings (#16808) * Use symbolic name for list function calls (#16862) * Enhance `substring` type inference - updated parameter types for substring to infer acceptable ranges based on the other arguments provided to the function. (#16859) * Prevent infinite recursion during type narrowing (#17028) * Fix command binding comment in bicepconfig.json (#16807) * `use-resource-id-functions` linter rule: Set to off by default (#16869) ### .bicepparam Bug Fixes * Suggest the experimental feature on the extends keyword for extendableparamfiles (#16744) * adding checks to ensure the given file exists before building the bicepparam file (#16742) * Clarifying parameter file generation logic and error message (#16662) ### Local Deploy * Local Deploy: process kill should be best-effort only (#16786) * Local Deploy: Support deploying Azure modules (#16752) * Local Deploy: Support long-running operations for local and Azure modules (#16797) * Documentation: Replace deploy pane content with link to MSDocs (#16736) * Local deploy: ensure languageversion 2.2-experimental emitting is enabled (#16945) ### Community Contributions * Remove unused methods (#16927) - thanks @eerhardt ! * Update DSC schema v3 (#16685) - thanks @Gijsreyn ! * support --pattern --outdir (#16882) - Thanks @NaridaL ! Example usage: ```sh bicep build --pattern './foo/**/*.bicep' --outdir ./bar bicep build-params --pattern './foo/**/*.bicepparam' --outdir ./bar ```
## Features and Bug Fixes * Use languageVersion 2.0 when an existing resource has an explicit dependency (#16670) * Generate deterministic dependsOn (#16668) * Add more detailed information about local-deploy (#16677) * Add more info on implementing extensions for local-deploy (#16678) * Add name pattern validation for modules (#16680) * Add Desired State Configuration target scope and experimental feature flag (#16389) - thanks @andyleejordan !