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
Copy file name to clipboardExpand all lines: bicep-examples/imports-exports/README.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ The import and export feature in Bicep allows you to reuse commonly used variabl
6
6
7
7
Instead of manually defining a variable in every new Bicep file, such as:
8
8
9
-
`var budgetAlertEmail = 'dan@rios.engineer'`
9
+
`var budgetAlertEmail = 'dan@rios.engineer'`
10
10
11
11
You can store this value centrally and simply import it into your template when needed.
12
12
@@ -37,7 +37,7 @@ var location = 'uksouth'
37
37
var branchOfficePublicIP = '82.110.72.90'
38
38
```
39
39
40
-
### Entra example:
40
+
### Entra example
41
41
42
42
```bicep
43
43
@export()
@@ -57,13 +57,15 @@ var entraSecurityGroups = {
57
57
}
58
58
}
59
59
```
60
+
60
61
## Import Examples
61
62
62
63
To import variables and types from your shared/central file you can use the `import as name` function to either import everything (*) or a specific variable (see branch office example below).
63
64
64
65
Once imported to the file, your Bicep intellisense will show your auto completion for your import name with all the available variables and types to use in the current template file.
65
66
66
67
### Entra ObjectId
68
+
67
69
```bicep
68
70
import * as shared from 'shared.bicep'
69
71
@@ -77,7 +79,8 @@ roleAssignments: [
77
79
]
78
80
```
79
81
80
-
### ACL IP Example:
82
+
### ACL IP Example
83
+
81
84
```bicep
82
85
import * as shared from 'shared.bicep'
83
86
// or you can only import the required variable vs all available via
@@ -116,4 +119,4 @@ or PowerShell
116
119
Connect-AzAccount
117
120
Set-AzContext -Subscription "subscription name or id"
0 commit comments