Skip to content

Commit c11719e

Browse files
authored
Merge pull request #295222 from jeffwmartinez/jefmarti-bicep-pivot-win
adding windows tab for bicep
2 parents 7787338 + 785311b commit c11719e

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

articles/app-service/provision-resource-bicep.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ms.author: msangapu
66
ms.topic: article
77
ms.custom: devx-track-bicep
88
ms.date: 11/18/2022
9+
zone_pivot_groups: app-service-bicep
910
---
1011

1112
# 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
2223

2324
## Review the template
2425

26+
::: zone pivot="app-service-bicep-linux"
27+
2528
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.
2629

2730
```bicep
@@ -113,6 +116,82 @@ To deploy a different language stack, update `linuxFxVersion` with appropriate v
113116

114117
---
115118

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
129+
param dockerContainerImage string = 'mcr.microsoft.com/dotnet/framework/samples:aspnetapp' // sample .NET app
130+
var appServicePlanName = toLower('ASP-${webAppName}') // generate unique name for App Service Plan
131+
132+
resource appServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
133+
name: appServicePlanName
134+
location: location
135+
sku: {
136+
name: sku
137+
}
138+
properties: {
139+
hyperV: true
140+
}
141+
}
142+
143+
resource webApp 'Microsoft.Web/sites@2024-04-01' = {
144+
name: webAppName
145+
location: location
146+
kind:'app,container,windows'
147+
properties: {
148+
serverFarmId: appServicePlan.id
149+
siteConfig: {
150+
windowsFxVersion: 'DOCKER|${dockerContainerImage}'
151+
appCommandLine: ''
152+
alwaysOn: true
153+
minTlsVersion: '1.3'
154+
}
155+
httpsOnly: true
156+
}
157+
}
158+
159+
```
160+
161+
Two Azure resources are defined in the template:
162+
163+
* [**Microsoft.Web/serverfarms**](/azure/templates/microsoft.web/serverfarms): create an App Service plan.
164+
* [**Microsoft.Web/sites**](/azure/templates/microsoft.web/sites): create an App Service app.
165+
166+
This template contains several parameters that are predefined for your convenience. See the table below for parameter defaults and their descriptions:
167+
168+
| Parameters | Type | Default value | Description |
169+
|------------|---------|------------------------------|-------------|
170+
| webAppName | string | "webApp-**[`<uniqueString>`](../azure-resource-manager/templates/template-functions-string.md#uniquestring)**" | App name |
171+
| location | string | "[[resourceGroup().location](../azure-resource-manager/templates/template-functions-resource.md#resourcegroup)]" | App region |
172+
| sku | string | "P1V3" | Instance size |
173+
| appServicePlanName | string | "toLower('ASP-${webAppName}')" | App Service Plan name |
174+
| dockerContainerImage | string | "mcr.microsoft.com/dotnet/framework/samples:aspnetapp" | container image sample |
175+
176+
---
177+
178+
## Deploy the template
179+
180+
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+
116195
## Validate the deployment
117196

118197
Browse to `http://<app_name>.azurewebsites.net/` and verify it's been created.

articles/zone-pivot-groups.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,15 @@ groups:
792792
title: Linux
793793
- id: github-actions-containers-windows
794794
title: Windows
795+
# Owner: jefmarti
796+
- id: app-service-bicep
797+
title: App Service Bicep
798+
prompt: Choose a platform
799+
pivots:
800+
- id: app-service-bicep-linux
801+
title: Linux
802+
- id: app-service-bicep-windows-container
803+
title: Windows container
795804
# Owner: msangapu
796805
- id: app-spaces-component-types
797806
title: App Spaces components

0 commit comments

Comments
 (0)