Skip to content

Commit bf48ac7

Browse files
committed
Add one deploy to ARM article
1 parent 21dbc03 commit bf48ac7

File tree

1 file changed

+99
-22
lines changed

1 file changed

+99
-22
lines changed

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

Lines changed: 99 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ For more information about the `sku` object, see [`SkuDefinition`](/azure/templa
436436
::: zone pivot="dedicated-plan"
437437
In the Dedicated (App Service) plan, your function app runs on dedicated VMs on Basic, Standard, and Premium SKUs in App Service plans, similar to web apps. For more information, see [Dedicated plan](./dedicated-plan.md).
438438

439-
For a sample Bicep file/Azure Resource Manager template, see [Function app on Azure App Service plan]
439+
For a sample Bicep file/Azure Resource Manager template, see [Function app on Azure App Service plan].
440440

441441
In Functions, the Dedicated plan is just a regular App Service plan, which is defined by a `serverfarm` resource. You must provide at least the `name` value. For a list of supported plan names, see the `--sku` setting in [`az appservice plan create`](/cli/azure/appservice/plan#az-appservice-plan-create) for the current list of supported values for a Dedicated plan.
442442

@@ -1208,7 +1208,14 @@ Your Bicep file or ARM template can optionally also define a deployment for your
12081208
+ [Linux container](./functions-how-to-custom-container.md)
12091209
::: zone-end
12101210
::: zone pivot="flex-consumption-plan"
1211-
In the Flex Consumption plan, your project code is deployed from a zip-compressed package published to a Blob storage container. For more information, see [Deployment](flex-consumption-plan.md#deployment). The specific storage account and container used for deployments, the authentication method, and credentials are set in the `functionAppConfig.deployment.storage` element of the `properties` for the site. The container and any application settings must exist when the app is created. For an example of how to create the storage container, see [Deployment container](#deployment-container).
1211+
In the Flex Consumption plan, your project code is deployed from a zip-compressed package published to a Blob storage container. Deployment of your code to this container is done using _[one deploy](./functions-deployment-technologies.md#one-deploy)_. For more information, see [Deployment](flex-consumption-plan.md#deployment).
1212+
1213+
>[!IMPORTANT]
1214+
>Don't upload your compressed deployment package directly in the deployment container. When you do this, your updated package won't get automatically deployed. You must instead define a package source that gets sent to the deployment container using one deploy.
1215+
1216+
### Deployment container
1217+
1218+
The specific storage account and container used for deployments, the authentication method, and credentials are set in the `functionAppConfig.deployment.storage` element of the `properties` for the site. The container and any application settings must exist when the app is created. For an example of how to create the storage container, see [Deployment container](#deployment-container).
12121219

12131220
This example uses a system assigned managed identity to access the specified blob storage container, which is created elsewhere in the deployment:
12141221

@@ -1239,25 +1246,34 @@ For a complete reference example, see [this ARM template](https://github.com/Azu
12391246
---
12401247

12411248
When using a connection string instead of managed identities, you need to instead set the `authentication.type` to `StorageAccountConnectionString` and set `authentication.storageAccountConnectionStringName` to the name of the application setting that contains the deployment storage account connection string.
1242-
::: zone-end
1243-
::: zone pivot="consumption-plan"
1244-
Your Bicep file or ARM template can optionally also define a deployment for your function code using a [zip deployment package](./deployment-zip-push.md).
1245-
::: zone-end
1246-
::: zone pivot="dedicated-plan,premium-plan,consumption-plan"
1247-
To successfully deploy your application by using Azure Resource Manager, it's important to understand how resources are deployed in Azure. In most examples, top-level configurations are applied by using `siteConfig`. It's important to set these configurations at a top level, because they convey information to the Functions runtime and deployment engine. Top-level information is required before the child `sourcecontrols/web` resource is applied. Although it's possible to configure these settings in the child-level `config/appSettings` resource, in some cases your function app must be deployed _before_ `config/appSettings` is applied.
12481249

1249-
## Zip deployment package
1250+
### Deployment package
12501251

1251-
Zip deployment is a recommended way to deploy your function app code. By default, functions that use zip deployment run in the deployment package itself. For more information, including the requirements for a deployment package, see [Zip deployment for Azure Functions](deployment-zip-push.md). When using resource deployment automation, you can reference the .zip deployment package in your Bicep or ARM template.
1252+
The Flex Consumption plan uses _one deploy_ for deploying your code project. The code package itself is the same as you would use for zip deployment in other Functions hosting plans. To include one deployment in your template, use the `/onedeploy` resource definition for the remote URL that contains the deployment package. The Functions host must be able to access both this remote package source and the deployment container.
12521253

1253-
To use zip deployment in your template, set the `WEBSITE_RUN_FROM_PACKAGE` setting in the app to `1` and include the `/zipDeploy` resource definition.
1254-
::: zone-end
1255-
::: zone pivot="consumption-plan"
1256-
For a Consumption plan on Linux, instead set the URI of the deployment package directly in the `WEBSITE_RUN_FROM_PACKAGE` setting, as shown in [this example template](https://github.com/Azure-Samples/function-app-arm-templates/tree/main/function-app-linux-consumption#L152).
1257-
::: zone-end
1258-
::: zone pivot="dedicated-plan,premium-plan,consumption-plan"
1259-
This example adds a zip deployment source to an existing app:
1254+
This example adds a one deploy source to an existing app:
1255+
1256+
### [Bicep](#tab/bicep)
1257+
1258+
```bicep
1259+
@description('The name of the function app.')
1260+
param functionAppName string
12601261
1262+
@description('The location into which the resources should be deployed.')
1263+
param location string = resourceGroup().location
1264+
1265+
@description('The zip content url.')
1266+
param packageUri string
1267+
1268+
resource functionAppName_OneDeploy 'Microsoft.Web/sites/extensions@2022-09-01' = {
1269+
name: '${functionAppName}/onedeploy'
1270+
location: location
1271+
properties: {
1272+
packageUri: packageUri
1273+
remoteBuild: false
1274+
}
1275+
}
1276+
```
12611277
### [ARM template](#tab/json)
12621278

12631279
```json
@@ -1268,7 +1284,7 @@ This example adds a zip deployment source to an existing app:
12681284
"functionAppName": {
12691285
"type": "string",
12701286
"metadata": {
1271-
"description": "The name of the Azure Function app."
1287+
"description": "The name of the Azure Functions app."
12721288
}
12731289
},
12741290
"location": {
@@ -1287,9 +1303,9 @@ This example adds a zip deployment source to an existing app:
12871303
},
12881304
"resources": [
12891305
{
1290-
"name": "[concat(parameters('functionAppName'), '/ZipDeploy')]",
1306+
"name": "[concat(parameters('functionAppName'), '/onedeploy')]",
12911307
"type": "Microsoft.Web/sites/extensions",
1292-
"apiVersion": "2021-02-01",
1308+
"apiVersion": "2022-09-01",
12931309
"location": "[parameters('location')]",
12941310
"properties": {
12951311
"packageUri": "[parameters('packageUri')]"
@@ -1298,6 +1314,27 @@ This example adds a zip deployment source to an existing app:
12981314
]
12991315
}
13001316
```
1317+
---
1318+
1319+
::: zone-end
1320+
::: zone pivot="consumption-plan"
1321+
Your Bicep file or ARM template can optionally also define a deployment for your function code using a [zip deployment package](./deployment-zip-push.md).
1322+
::: zone-end
1323+
::: zone pivot="dedicated-plan,premium-plan,consumption-plan"
1324+
To successfully deploy your application by using Azure Resource Manager, it's important to understand how resources are deployed in Azure. In most examples, top-level configurations are applied by using `siteConfig`. It's important to set these configurations at a top level, because they convey information to the Functions runtime and deployment engine. Top-level information is required before the child `sourcecontrols/web` resource is applied. Although it's possible to configure these settings in the child-level `config/appSettings` resource, in some cases your function app must be deployed _before_ `config/appSettings` is applied.
1325+
1326+
## Zip deployment package
1327+
1328+
Zip deployment is a recommended way to deploy your function app code. By default, functions that use zip deployment run in the deployment package itself. For more information, including the requirements for a deployment package, see [Zip deployment for Azure Functions](deployment-zip-push.md). When using resource deployment automation, you can reference the .zip deployment package in your Bicep or ARM template.
1329+
1330+
To use zip deployment in your template, set the `WEBSITE_RUN_FROM_PACKAGE` setting in the app to `1` and include the `/zipDeploy` resource definition.
1331+
::: zone-end
1332+
::: zone pivot="consumption-plan"
1333+
For a Consumption plan on Linux, instead set the URI of the deployment package directly in the `WEBSITE_RUN_FROM_PACKAGE` setting, as shown in [this example template](https://github.com/Azure-Samples/function-app-arm-templates/tree/main/function-app-linux-consumption#L152).
1334+
::: zone-end
1335+
::: zone pivot="dedicated-plan,premium-plan,consumption-plan"
1336+
This example adds a zip deployment source to an existing app:
1337+
13011338
### [Bicep](#tab/bicep)
13021339

13031340
```bicep
@@ -1318,6 +1355,46 @@ resource functionAppName_ZipDeploy 'Microsoft.Web/sites/extensions@2021-02-01' =
13181355
}
13191356
}
13201357
```
1358+
### [ARM template](#tab/json)
1359+
1360+
```json
1361+
{
1362+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
1363+
"contentVersion": "1.0.0.0",
1364+
"parameters": {
1365+
"functionAppName": {
1366+
"type": "string",
1367+
"metadata": {
1368+
"description": "The name of the Azure Functions app."
1369+
}
1370+
},
1371+
"location": {
1372+
"type": "string",
1373+
"defaultValue": "[resourceGroup().location]",
1374+
"metadata": {
1375+
"description": "The location into which the resources should be deployed."
1376+
}
1377+
},
1378+
"packageUri": {
1379+
"type": "string",
1380+
"metadata": {
1381+
"description": "The zip content url."
1382+
}
1383+
}
1384+
},
1385+
"resources": [
1386+
{
1387+
"name": "[concat(parameters('functionAppName'), '/ZipDeploy')]",
1388+
"type": "Microsoft.Web/sites/extensions",
1389+
"apiVersion": "2021-02-01",
1390+
"location": "[parameters('location')]",
1391+
"properties": {
1392+
"packageUri": "[parameters('packageUri')]"
1393+
}
1394+
}
1395+
]
1396+
}
1397+
```
13211398
---
13221399

13231400
Keep the following things in mind when including zip deployment resources in your template:
@@ -1838,7 +1915,7 @@ These application settings are required for container deployments:
18381915

18391916
Keep these considerations in mind when working with site and application settings using Bicep files or ARM templates:
18401917
::: zone pivot="flex-consumption-plan"
1841-
+ The optional `alwaysReady` setting contains an array of one or more `{name,instanceCount}` objects, with one for each [per-function scale group](flex-consumption-plan.md#per-function-scaling). These are the scale groups being used to make always-ready scale decisions. This example sets always-ready counts for both the `http` group and a single function named `helloworld`, which is of a non-grouped trigger type:
1918+
+ The optional `alwaysReady` setting contains an array of one or more `{name,instanceCount}` objects, with one for each [per-function scale group](flex-consumption-plan.md#per-function-scaling). These are the scale groups being used to make always-ready scale decisions. This example sets always-ready counts for both the `http` group and a single function named `helloworld`, which is of a nongrouped trigger type:
18421919
### [Bicep](#tab/bicep)
18431920
```bicep
18441921
alwaysReady: [
@@ -2068,7 +2145,7 @@ Here's an example that uses HTML:
20682145

20692146
### Deploy using PowerShell
20702147

2071-
The following PowerShell commands create a resource group and deploy a Bicep file or ARM template that creates a function app with its required resources. To run locally, you must have [Azure PowerShell](/powershell/azure/install-azure-powershell) installed. Run [`Connect-AzAccount`](/powershell/module/az.accounts/connect-azaccount) to sign in.
2148+
The following PowerShell commands create a resource group and deploy a Bicep file or ARM template that creates a function app with its required resources. To run locally, you must have [Azure PowerShell](/powershell/azure/install-azure-powershell) installed. To sign in to Azure, you must first run [`Connect-AzAccount`](/powershell/module/az.accounts/connect-azaccount).
20722149

20732150
#### [Bicep](#tab/bicep)
20742151

0 commit comments

Comments
 (0)