You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The spread operation can be used to avoid setting an optional property. For example:
77
+
The spread operation can be used to avoid setting an optional property. In the following example, _accessTier_ is set only if the parameter _tier_ isn't an empty string.
78
78
79
79
```bicep
80
-
param vmImageResourceId string = ''
81
-
82
-
var bar = vmImageResourceId != '' ? {
83
-
id: vmImageResourceId
84
-
} : {}
85
-
86
-
output foo object = {
87
-
...bar
88
-
alwaysSet: 'value'
80
+
param location string = resourceGroup().location
81
+
param tier string = 'Hot'
82
+
83
+
var storageAccountName = uniqueString(resourceGroup().id)
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/quickstart-create-bicep-use-visual-studio-code.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Create Bicep files - Visual Studio Code
3
3
description: Use Visual Studio Code and the Bicep extension to Bicep files for deploy Azure resources
4
-
ms.date: 03/20/2024
4
+
ms.date: 08/05/2024
5
5
ms.topic: quickstart
6
6
ms.custom: mode-ui, devx-track-bicep
7
7
#Customer intent: As a developer new to Azure deployment, I want to learn how to use Visual Studio Code to create and edit Bicep files, so I can use them to deploy Azure resources.
@@ -172,6 +172,10 @@ You're almost done. Just provide values for those properties.
172
172
173
173
Again, intellisense helps you. Set `name` to `storageAccountName`, which is the parameter that contains a name for the storage account. For `location`, set it to `location`, which is a parameter you created earlier. When adding `sku.name` and `kind`, intellisense presents the valid options.
174
174
175
+
To add optional properties alongside the required properties, place the cursor at the desired location and press <kbd>Ctrl</kbd>+<kbd>Space</kbd>. Intellisense suggests unused properties as shown in the following screenshot.
176
+
177
+
:::image type="content" source="./media/quickstart-create-bicep-use-visual-studio-code/bicep-visual-studio-code-add-properties.png" alt-text="Screenshot of adding additional properties.":::
0 commit comments