Skip to content

Commit ce8d223

Browse files
committed
update
1 parent 98ed125 commit ce8d223

File tree

1 file changed

+38
-15
lines changed

1 file changed

+38
-15
lines changed

articles/azure-functions/functions-infrastructure-as-code.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ ms.custom: fasttrack-edit, devx-track-azurepowershell
1212

1313
You can use a Bicep file or an Azure Resource Manager template to deploy a function app. This article outlines the required resources and parameters for doing so. You might need to deploy other resources, depending on the [triggers and bindings](functions-triggers-bindings.md) in your function app.
1414

15-
***jgao: use tabs here
15+
# [Bicep](#tab/bicep)
16+
17+
```bicep
1618
For more information about creating Bicep files, see [Understand the structure and syntax of Bicep files](../azure-resource-manager/bicep/file.md).
19+
```
20+
21+
# [JSON](#tab/json)
22+
1723
For more information about creating templates, see [Authoring Azure Resource Manager templates](../azure-resource-manager/templates/syntax.md).
1824

25+
---
26+
1927
For sample templates, see:
2028

2129
- [ARM templates for function app deployment](https://github.com/Azure-Samples/function-app-arm-templates)
@@ -26,14 +34,28 @@ For sample templates, see:
2634

2735
An Azure Functions deployment typically consists of these resources:
2836

29-
***jgao: use tabs here
37+
# [Bicep](#tab/bicep)
38+
39+
```bicep
40+
41+
| Resource | Requirement | Syntax and properties reference |
42+
|------------------------------------------------------------------------------------|-------------|-----------------------------------------------------------------------------------------|
43+
| A function app | Required | [Microsoft.Web/sites](/azure/templates/microsoft.web/sites?pivots=deployment-language-bicep) |
44+
| An [Azure Storage](../storage/index.yml) account | Required | [Microsoft.Storage/storageAccounts](/azure/templates/microsoft.storage/storageaccounts?pivots=deployment-language-bicep) |
45+
| An [Application Insights](../azure-monitor/app/app-insights-overview.md) component | Optional | [Microsoft.Insights/components](/azure/templates/microsoft.insights/components?pivots=deployment-language-bicep) |
46+
| A [hosting plan](./functions-scale.md) | Optional<sup>1</sup> | [Microsoft.Web/serverfarms](/azure/templates/microsoft.web/serverfarms?pivots=deployment-language-bicep)
47+
```
48+
49+
# [JSON](#tab/json)
3050

3151
| Resource | Requirement | Syntax and properties reference |
3252
|------------------------------------------------------------------------------------|-------------|-----------------------------------------------------------------------------------------|
33-
| A function app | Required | [Microsoft.Web/sites](/azure/templates/microsoft.web/sites) |
34-
| An [Azure Storage](../storage/index.yml) account | Required | [Microsoft.Storage/storageAccounts](/azure/templates/microsoft.storage/storageaccounts) |
35-
| An [Application Insights](../azure-monitor/app/app-insights-overview.md) component | Optional | [Microsoft.Insights/components](/azure/templates/microsoft.insights/components) |
36-
| A [hosting plan](./functions-scale.md) | Optional<sup>1</sup> | [Microsoft.Web/serverfarms](/azure/templates/microsoft.web/serverfarms) |
53+
| A function app | Required | [Microsoft.Web/sites](/azure/templates/microsoft.web/sites?pivots=deployment-language-arm-template) |
54+
| An [Azure Storage](../storage/index.yml) account | Required | [Microsoft.Storage/storageAccounts](/azure/templates/microsoft.storage/storageaccounts?pivots=deployment-language-arm-template) |
55+
| An [Application Insights](../azure-monitor/app/app-insights-overview.md) component | Optional | [Microsoft.Insights/components](/azure/templates/microsoft.insights/components?pivots=deployment-language-arm-template) |
56+
| A [hosting plan](./functions-scale.md) | Optional<sup>1</sup> | [Microsoft.Web/serverfarms](/azure/templates/microsoft.web/serverfarms?pivots=deployment-language-arm-template) |
57+
58+
---
3759

3860
<sup>1</sup>A hosting plan is only required when you choose to run your function app on a [Premium plan](./functions-premium-plan.md) or on an [App Service plan](../app-service/overview-hosting-plans.md).
3961

@@ -188,6 +210,7 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
188210

189211
```json
190212
{
213+
"type": "Microsoft.Insights/components",
191214
"apiVersion": "2020-02-02",
192215
"name": "[variables('applicationInsightsName')]",
193216
"location": "[parameters('appInsightsLocation')]",
@@ -223,7 +246,7 @@ appSettings: [
223246
"appSettings": [
224247
{
225248
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
226-
"value": "[reference(resourceId('Microsoft.Insights/components', variables('appInsightsName'))).InstrumentationKey]" },
249+
"value": "[reference(resourceId('Microsoft.Insights/components', variables('appInsightsName')), '2020-02-02').InstrumentationKey]"},
227250
{
228251
]
229252
```
@@ -287,8 +310,8 @@ resource functionApp 'Microsoft.Web/sites@2022-03-01' = {
287310
"httpsOnly": true
288311
},
289312
"dependsOn": [
290-
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
291-
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
313+
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
314+
"[resourceId('Microsoft.Insights/components', variables('appInsightsName'))]"
292315
]
293316
}
294317
```
@@ -517,7 +540,7 @@ resource site 'Microsoft.Web/sites@2022-03-01' = {
517540
"appSettings": [
518541
{
519542
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
520-
"value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))).InstrumentationKey]"
543+
"value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2020-02-02').InstrumentationKey]"
521544
},
522545
{
523546
"name": "AzureWebJobsStorage",
@@ -627,7 +650,7 @@ resource site 'Microsoft.Web/sites@2022-03-01' = {
627650
"appSettings": [
628651
{
629652
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
630-
"value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))).InstrumentationKey]"
653+
"value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2020-02-02).InstrumentationKey]"
631654
},
632655
{
633656
"name": "AzureWebJobsStorage",
@@ -778,7 +801,7 @@ resource functionAppName_resource 'Microsoft.Web/sites@2022-03-01' = {
778801
appSettings: [
779802
{
780803
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
781-
value: reference(applicationInsightsName.id, '2015-05-01').InstrumentationKey
804+
value: reference(applicationInsightsName.id, '2020-02-02').InstrumentationKey
782805
}
783806
{
784807
name: 'AzureWebJobsStorage'
@@ -830,7 +853,7 @@ resource functionAppName_resource 'Microsoft.Web/sites@2022-03-01' = {
830853
"appSettings": [
831854
{
832855
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
833-
"value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2015-05-01').InstrumentationKey]"
856+
"value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2020-02-02').InstrumentationKey]"
834857
},
835858
{
836859
"name": "AzureWebJobsStorage",
@@ -886,7 +909,7 @@ resource site 'Microsoft.Web/sites@2021-02-01' = {
886909
appSettings: [
887910
{
888911
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
889-
value: reference(applicationInsight.id, '2015-05-01').InstrumentationKey
912+
value: reference(applicationInsight.id, '2020-02-02').InstrumentationKey
890913
}
891914
{
892915
name: 'AzureWebJobsStorage'
@@ -936,7 +959,7 @@ resource site 'Microsoft.Web/sites@2021-02-01' = {
936959
"appSettings": [
937960
{
938961
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
939-
"value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2015-05-01').InstrumentationKey]"
962+
"value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2020-02-02').InstrumentationKey]"
940963
},
941964
{
942965
"name": "AzureWebJobsStorage",

0 commit comments

Comments
 (0)