Created
March 19, 2023 12:34
-
-
Save ievgen-pavlenko/3482d2439579c9466cf0c15c4d9a31a1 to your computer and use it in GitHub Desktop.
This Bicep file automates the creation of a fully integrated Azure infrastructure by creating an app service plan, app service, key vault, storage account, and virtual network (VNet) and associating them all with the VNet.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param location string = resourceGroup().location | |
param appServiceName string = 'app-${uniqueString(resourceGroup().id)}' | |
param appServicePlanName string = 'AppServicePlan-${appServiceName}' | |
param keyVaultName string = 'test-kv-${uniqueString(resourceGroup().id)}' | |
param storageAccountName string = 'teststg${uniqueString(resourceGroup().id)}' | |
param sku string = 'S1' | |
param vnetName string = 'vnet' | |
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = { | |
name: appServicePlanName | |
location: location | |
sku: { | |
name: sku | |
} | |
} | |
resource appService 'Microsoft.Web/sites@2022-03-01' = { | |
name: appServiceName | |
location: location | |
properties: { | |
serverFarmId: appServicePlan.id | |
virtualNetworkSubnetId: defaultSubnet.id | |
} | |
} | |
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { | |
name: storageAccountName | |
location: location | |
kind: 'StorageV2' | |
sku: { | |
name: 'Standard_LRS' | |
} | |
properties: { | |
networkAcls: { | |
bypass: 'AzureServices' | |
virtualNetworkRules: [ | |
{ | |
id: defaultSubnet.id | |
} | |
] | |
ipRules: [ { value: '8.8.8.8' } ] | |
defaultAction: 'Deny' | |
} | |
} | |
} | |
resource keyVault 'Microsoft.KeyVault/vaults@2022-11-01' = { | |
name: keyVaultName | |
location: location | |
properties: { | |
sku: { | |
name: 'standard' | |
family: 'A' | |
} | |
tenantId: subscription().tenantId | |
enableRbacAuthorization: true | |
networkAcls: { | |
bypass: 'AzureServices' | |
virtualNetworkRules: [ | |
{ | |
id: defaultSubnet.id | |
} | |
] | |
ipRules: [ { value: '8.8.8.8/32' } ] | |
defaultAction: 'Deny' | |
} | |
} | |
} | |
resource vnet 'Microsoft.Network/virtualNetworks@2022-09-01' = { | |
name: vnetName | |
location: location | |
properties: { | |
addressSpace: { | |
addressPrefixes: [ | |
'10.0.0.0/16' | |
] | |
} | |
} | |
} | |
resource defaultSubnet 'Microsoft.Network/virtualNetworks/subnets@2022-09-01' = { | |
parent: vnet | |
name: 'default' | |
properties: { | |
addressPrefix: '10.0.0.0/24' | |
serviceEndpoints: [ | |
{ | |
service: 'Microsoft.KeyVault' | |
locations: [ | |
location | |
] | |
} | |
{ | |
service: 'Microsoft.Storage' | |
locations: [ | |
location | |
] | |
} | |
{ | |
service: 'Microsoft.Web' | |
locations: [ | |
location | |
] | |
} | |
] | |
delegations: [ | |
{ | |
name: 'delegation' | |
properties: { | |
serviceName: 'Microsoft.Web/serverfarms' | |
} | |
type: 'Microsoft.Network/virtualNetworks/subnets/delegations' | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment