Skip to content

Commit

Permalink
add bicep templates for the beginner bicep tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
mumian committed Feb 18, 2021
1 parent 11d1149 commit e1cc2d1
Show file tree
Hide file tree
Showing 12 changed files with 479 additions and 3 deletions.
65 changes: 65 additions & 0 deletions get-started-deployment/linked-template/azuredeploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
param projectName string {
minLength: 3
maxLength: 11
metadata: {
description: 'Specify a project name that is used to generate resource names.'
}
}
param location string {
metadata: {
description: 'Specify a location for the resources.'
}
default: resourceGroup().location
}
param linuxFxVersion string {
metadata: {
description: 'Specify the Runtime stack of current web app'
}
default: 'php|7.0'
}
param linkedTemplateUri string{
metadata: {
description: 'The Uri of the linked template.'
}
}
var storageAccountName_var = concat(projectName, uniqueString(resourceGroup().id))
var webAppName_var = '${projectName}WebApp'
var appServicePlanName_var = '${projectName}Plan'

resource linkedTemplate 'Microsoft.Resources/deployments@2018-05-01' = {
name: linkedTemplateUri

}

resource appServicePlanName 'Microsoft.Web/serverfarms@2020-09-01' = {
name: appServicePlanName_var
location: location
sku: {
name: 'B1'
tier: 'Basic'
size: 'B1'
family: 'B'
capacity: 1
}
kind: 'linux'
properties: {
perSiteScaling: false
reserved: true
targetWorkerCount: 0
targetWorkerSizeId: 0
}
}

resource webAppName 'Microsoft.Web/sites@2020-09-01' = {
name: webAppName_var
location: location
kind: 'app'
properties: {
serverFarmId: appServicePlanName.id
siteConfig: {
linuxFxVersion: linuxFxVersion
}
}
}

output storageEndpoint object = reference(storageAccountName_var).primaryEndpoints
40 changes: 40 additions & 0 deletions get-started-deployment/linked-template/linkedStorageAcceount.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
param storageAccountName string {
metadata: {
description: 'Specify the storage account name.'
}
}
param location string {
metadata: {
description: 'Specify a location for the resources.'
}
}
param storageSKU string {
allowed: [
'Standard_LRS'
'Standard_GRS'
'Standard_RAGRS'
'Standard_ZRS'
'Premium_LRS'
'Premium_ZRS'
'Standard_GZRS'
'Standard_RAGZRS'
]
metadata: {
description: 'Specify the storage account type.'
}
default: 'Standard_LRS'
}

resource storageAccountName_resource 'Microsoft.Storage/storageAccounts@2019-04-01' = {
name: storageAccountName
location: location
sku: {
name: storageSKU
}
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
}
}

output storageEndpoint object = reference(storageAccountName).primaryEndpoints
6 changes: 3 additions & 3 deletions get-started-deployment/local-template/azuredeploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var storageAccountName_var = concat(projectName, uniqueString(resourceGroup().id
var webAppName_var = '${projectName}WebApp'
var appServicePlanName_var = '${projectName}Plan'

resource storageAccountName 'Microsoft.Storage/storageAccounts@2019-04-01' = {
resource storageAccountName 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: storageAccountName_var
location: location
sku: {
Expand All @@ -50,7 +50,7 @@ resource storageAccountName 'Microsoft.Storage/storageAccounts@2019-04-01' = {
}
}

resource appServicePlanName 'Microsoft.Web/serverfarms@2016-09-01' = {
resource appServicePlanName 'Microsoft.Web/serverfarms@2020-09-01' = {
name: appServicePlanName_var
location: location
sku: {
Expand All @@ -69,7 +69,7 @@ resource appServicePlanName 'Microsoft.Web/serverfarms@2016-09-01' = {
}
}

resource webAppName 'Microsoft.Web/sites@2018-11-01' = {
resource webAppName 'Microsoft.Web/sites@2020-09-01' = {
name: webAppName_var
location: location
kind: 'app'
Expand Down
30 changes: 30 additions & 0 deletions get-started-with-templates/add-location/azuredeploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
param storageName string {
minLength: 3
maxLength: 24
}
param storageSKU string {
allowed: [
'Standard_LRS'
'Standard_GRS'
'Standard_RAGRS'
'Standard_ZRS'
'Premium_LRS'
'Premium_ZRS'
'Standard_GZRS'
'Standard_RAGZRS'
]
default: 'Standard_LRS'
}
param location string = resourceGroup().location

resource storageName_resource 'Microsoft.Storage/storageAccounts@2019-04-01' = {
name: storageName
location: location
sku: {
name: storageSKU
}
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
}
}
16 changes: 16 additions & 0 deletions get-started-with-templates/add-name/azuredeploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
param storageName string {
minLength: 3
maxLength: 24
}

resource provide_unique_name 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: storageName
location: 'eastus'
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
}
}
34 changes: 34 additions & 0 deletions get-started-with-templates/add-outputs/azuredeploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
param storagePrefix string {
minLength: 3
maxLength: 11
}
param storageSKU string {
allowed: [
'Standard_LRS'
'Standard_GRS'
'Standard_RAGRS'
'Standard_ZRS'
'Premium_LRS'
'Premium_ZRS'
'Standard_GZRS'
'Standard_RAGZRS'
]
default: 'Standard_LRS'
}
param location string = resourceGroup().location

var uniqueStorageName_var = concat(storagePrefix, uniqueString(resourceGroup().id))

resource uniqueStorageName 'Microsoft.Storage/storageAccounts@2019-04-01' = {
name: uniqueStorageName_var
location: location
sku: {
name: storageSKU
}
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
}
}

output storageEndpoint object = reference(uniqueStorageName_var).primaryEndpoints
29 changes: 29 additions & 0 deletions get-started-with-templates/add-sku/azuredeploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
param storageName string {
minLength: 3
maxLength: 24
}
param storageSKU string {
default: 'Standard_LRS'
allowed:[
'Standard_LRS'
'Standard_GRS'
'Standard_RAGRS'
'Standard_ZRS'
'Premium_LRS'
'Premium_ZRS'
'Standard_GZRS'
'Standard_RAGZRS'
]
}

resource provide_unique_name 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: storageName
location: 'eastus'
sku: {
name: storageSKU
}
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
}
}
11 changes: 11 additions & 0 deletions get-started-with-templates/add-storage/azuredeploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource provide_unique_name 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: '{provide-unique-name}'
location: 'eastus'
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
}
}
86 changes: 86 additions & 0 deletions get-started-with-templates/add-tags/azuredeploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
param storagePrefix string {
minLength: 3
maxLength: 11
}
param storageSKU string {
allowed: [
'Standard_LRS'
'Standard_GRS'
'Standard_RAGRS'
'Standard_ZRS'
'Premium_LRS'
'Premium_ZRS'
'Standard_GZRS'
'Standard_RAGZRS'
]
default: 'Standard_LRS'
}
param location string = resourceGroup().location
param appServicePlanName string = 'exampleplan'
param webAppName string {
minLength: 2
metadata: {
description: 'Base name of the resource such as web app name and app service plan '
}
}
param linuxFxVersion string {
metadata: {
description: 'The Runtime stack of current web app'
}
default: 'php|7.0'
}
param resourceTags object = {
Environment: 'Dev'
Project: 'Tutorial'
}

var uniqueStorageName_var = concat(storagePrefix, uniqueString(resourceGroup().id))
var webAppPortalName_var = concat(webAppName, uniqueString(resourceGroup().id))

resource uniqueStorageName 'Microsoft.Storage/storageAccounts@2019-04-01' = {
name: uniqueStorageName_var
location: location
tags: resourceTags
sku: {
name: storageSKU
}
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
}
}

resource appServicePlanName_resource 'Microsoft.Web/serverfarms@2016-09-01' = {
name: appServicePlanName
location: location
tags: resourceTags
sku: {
name: 'B1'
tier: 'Basic'
size: 'B1'
family: 'B'
capacity: 1
}
kind: 'linux'
properties: {
perSiteScaling: false
reserved: true
targetWorkerCount: 0
targetWorkerSizeId: 0
}
}

resource webAppPortalName 'Microsoft.Web/sites@2016-08-01' = {
name: webAppPortalName_var
location: location
tags: resourceTags
kind: 'app'
properties: {
serverFarmId: appServicePlanName_resource.id
siteConfig: {
linuxFxVersion: linuxFxVersion
}
}
}

output storageEndpoint object = reference(uniqueStorageName_var).primaryEndpoints
32 changes: 32 additions & 0 deletions get-started-with-templates/add-variable/azuredeploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
param storagePrefix string {
minLength: 3
maxLength: 11
}
param storageSKU string {
allowed: [
'Standard_LRS'
'Standard_GRS'
'Standard_RAGRS'
'Standard_ZRS'
'Premium_LRS'
'Premium_ZRS'
'Standard_GZRS'
'Standard_RAGZRS'
]
default: 'Standard_LRS'
}
param location string = resourceGroup().location

var uniqueStorageName_var = concat(storagePrefix, uniqueString(resourceGroup().id))

resource uniqueStorageName 'Microsoft.Storage/storageAccounts@2019-04-01' = {
name: uniqueStorageName_var
location: location
sku: {
name: storageSKU
}
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
}
}
Loading

0 comments on commit e1cc2d1

Please sign in to comment.