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: articles/app-service/provision-resource-bicep.md
+79Lines changed: 79 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ ms.author: msangapu
6
6
ms.topic: article
7
7
ms.custom: devx-track-bicep
8
8
ms.date: 11/18/2022
9
+
zone_pivot_groups: app-service-bicep
9
10
---
10
11
11
12
# Create App Service app using Bicep
@@ -22,6 +23,8 @@ To effectively create resources with Bicep, you'll need to set up a Bicep [devel
22
23
23
24
## Review the template
24
25
26
+
::: zone pivot="app-service-bicep-linux"
27
+
25
28
The template used in this quickstart is shown below. It deploys an App Service plan and an App Service app on Linux and a sample Node.js "Hello World" app from the [Azure Samples](https://github.com/Azure-Samples) repo.
26
29
27
30
```bicep
@@ -113,6 +116,82 @@ To deploy a different language stack, update `linuxFxVersion` with appropriate v
113
116
114
117
---
115
118
119
+
::: zone-end
120
+
121
+
::: zone pivot="app-service-bicep-windows-container"
122
+
123
+
The template used in this quickstart is shown below. It deploys an App Service plan and an App Service app on Windows and a sample .NET "Hello World" app from the [Azure Samples](https://github.com/Azure-Samples) repo.
124
+
125
+
```bicep
126
+
param webAppName string = uniqueString(resourceGroup().id) // generate unique name for web app
127
+
param location string = resourceGroup().location // location for all resources
128
+
param sku string = 'P1V3' // The SKU of App Service Plan
Copy and paste the template to your preferred editor/IDE and save the file to your local working directory.
181
+
182
+
Azure CLI is used here to deploy the template. You can also use the Azure portal, Azure PowerShell, and REST API. To learn other deployment methods, see [Bicep Deployment Commands](../azure-resource-manager/bicep/deploy-cli.md).
183
+
184
+
The following code creates a resource group, an App Service plan, and a web app. A default resource group, App Service plan, and location have been set for you. Replace `<app-name>` with a globally unique app name (valid characters are `a-z`, `0-9`, and `-`).
185
+
186
+
Open up a terminal where the Azure CLI is installed and run the code below to create a .NET app.
187
+
188
+
```azurecli-interactive
189
+
az group create --name myResourceGroup --location "southcentralus" &&
190
+
az deployment group create --resource-group myResourceGroup --template-file <path-to-template>
191
+
```
192
+
193
+
::: zone-end
194
+
116
195
## Validate the deployment
117
196
118
197
Browse to `http://<app_name>.azurewebsites.net/` and verify it's been created.
+[Visual Studio Code](https://github.com/Azure/azure-functions-on-container-apps/tree/main/samples/VSCode%20Sample)
60
60
61
+
You can continuously deploy your containerized apps from source code using either [Azure Pipelines](functions-how-to-azure-devops.md?pivots=v1#deploy-a-container) or [GitHub Actions](https://github.com/Azure/azure-functions-on-container-apps/tree/main/samples/GitHubActions). The continuous deployment feature of Functions isn't currently supported when deploying to Container Apps.
62
+
63
+
## Managed identity authorization
64
+
65
+
For the best security, you should connect to remote services using Microsoft Entra authentication and managed identity authorization. You can use managed identities for these connections:
When running in Container Apps, you can use Microsoft Entra ID with managed identities for all binding extensions that support managed identities. Currently, only these binding extensions support event-driven scaling when using managed identity authentication:
71
+
72
+
+ Azure Event Hubs
73
+
+ Azure Queue Storage
74
+
+ Azure Service Bus
75
+
76
+
For other bindings, use fixed replicas when using managed identity authentication. For more information, see the [Functions developer guide](./functions-reference.md#connections).
77
+
61
78
## Virtual network integration
62
79
63
80
When you host your function apps in a Container Apps environment, your functions are able to take advantage of both internally and externally accessible virtual networks. To learn more about environment networks, see [Networking in Azure Container Apps environment](../container-apps/networking.md).
64
81
65
-
## Configure scale rules
82
+
## Event-driven scaling
83
+
84
+
All Functions triggers can be used in your containerized function app. However, only these triggers can dynamically scale (from zero instances) based on received events when running in a Container Apps environment:
85
+
86
+
+ Azure Event Grid
87
+
+ Azure Event Hubs
88
+
+ Azure Blob Storage (event-based)
89
+
+ Azure Queue Storage
90
+
+ Azure Service Bus
91
+
+ Durable Functions (MSSQL storage provider)
92
+
+ HTTP
93
+
+ Kafka
94
+
+ Timer
66
95
67
96
Azure Functions on Container Apps is designed to configure the scale parameters and rules as per the event target. You don't need to worry about configuring the KEDA scaled objects. You can still set minimum and maximum replica count when creating or modifying your function app. The following Azure CLI command sets the minimum and maximum replica count when creating a new function app in a Container Apps environment from an Azure Container Registry:
68
97
@@ -86,33 +115,31 @@ A managed resource group gets removed automatically after all function app conta
86
115
87
116
If you run into any issues with these managed resource groups, you should contact support.
88
117
118
+
## Application logging
119
+
120
+
You can monitor your containerized function app hosted in Container Apps using Azure Monitor Application Insights in the same way you do with apps hosted by Azure Functions. For more information, see [Monitor Azure Functions](./monitor-functions.md).
121
+
122
+
For bindings that support event-driven scaling, scale events are logged as `FunctionsScalerInfo` and `FunctionsScalerError` events in your Log Analytics workspace. For more information, see [Application Logging in Azure Container Apps](../container-apps/logging.md).
123
+
89
124
## Considerations for Container Apps hosting
90
125
91
126
Keep in mind the following considerations when deploying your function app containers to Container Apps:
92
127
93
-
+ While all triggers can be used, only the following triggers can dynamically scale (from zero instances) when running in a Container Apps environment:
94
-
+ Azure Event Grid
95
-
+ Azure Event Hubs
96
-
+ Azure Blob storage (event-based)
97
-
+ Azure Queue Storage
98
-
+ Azure Service Bus
99
-
+ Durable Functions (MSSQL storage provider)
100
-
+ HTTP
101
-
+ Kafka
102
-
+ Timer
103
128
+ These limitations apply to Kafka triggers:
104
129
+ The protocol value of `ssl` isn't supported when hosted on Container Apps. Use a [different protocol value](functions-bindings-kafka-trigger.md?pivots=programming-language-csharp#attributes).
105
-
+ For a Kafka trigger to dynamically scale when connected to Event Hubs, the `username` property must resolve to an application setting that contains the actual username value. When the default `$ConnectionString` value is used, the Kafka trigger won't be able to cause the app to scale dynamically.
130
+
+ For a Kafka trigger to dynamically scale when connected to Event Hubs, the `username` property must resolve to an application setting that contains the actual username value. When the default `$ConnectionString` value is used, the Kafka trigger isn't able to cause the app to scale dynamically.
106
131
+ For the built-in Container Apps [policy definitions](../container-apps/policy-reference.md#policy-definitions), currently only environment-level policies apply to Azure Functions containers.
107
132
+ You can use managed identities for these connections:
108
133
+[Deployment from an Azure Container Registry](functions-deploy-container-apps.md?tabs=acr#create-and-configure-a-function-app-on-azure-with-the-image)
109
134
+[Triggers and bindings](functions-reference.md#configure-an-identity-based-connection)
+ By default, a containerized function app monitors port 80 for incoming requests. If your app must use a different port, use the [`WEBSITES_PORT` application setting](../app-service/reference-app-settings.md#custom-containers) to change this default port.
137
+
+ You aren't currently able to use built-in continuous deployment features when hosting on Container Apps. You must instead deploy from source code using either [Azure Pipelines](functions-how-to-azure-devops.md?pivots=v1#deploy-a-container) or [GitHub Actions](https://github.com/Azure/azure-functions-on-container-apps/tree/main/samples/GitHubActions).
111
138
+ You currently can't move a Container Apps hosted function app deployment between resource groups or between subscriptions. Instead, you would have to recreate the existing containerized app deployment in a new resource group, subscription, or region.
112
139
+ When using Container Apps, you don't have direct access to the lower-level Kubernetes APIs.
113
140
+ The `containerapp` extension conflicts with the `appservice-kube` extension in Azure CLI. If you have previously published apps to Azure Arc, run `az extension list` and make sure that `appservice-kube` isn't installed. If it is, you can remove it by running `az extension remove -n appservice-kube`.
114
141
115
-
## Next steps
142
+
## Related articles
116
143
117
144
+[Hosting and scale](./functions-scale.md)
118
145
+[Create your first containerized functions on Container Apps](./functions-deploy-container-apps.md)
0 commit comments