-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.bicep
64 lines (59 loc) · 1.58 KB
/
main.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@description('Location for all resources.')
param location string = resourceGroup().location
var storageAccountName = 'storage${uniqueString(resourceGroup().id)}'
var endpointName = 'endpoint-${uniqueString(resourceGroup().id)}'
var profileName = 'cdn-${uniqueString(resourceGroup().id)}'
var storageAccountHostName = replace(replace(storageAccount.properties.primaryEndpoints.blob, 'https://', ''), '/', '')
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-01-01' = {
name: storageAccountName
location: location
tags: {
displayName: storageAccountName
}
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
}
resource cdnProfile 'Microsoft.Cdn/profiles@2020-09-01' = {
name: profileName
location: location
tags: {
displayName: profileName
}
sku: {
name: 'Standard_Verizon'
}
}
resource endpoint 'Microsoft.Cdn/profiles/endpoints@2020-09-01' = {
parent: cdnProfile
name: endpointName
location: location
tags: {
displayName: endpointName
}
properties: {
originHostHeader: storageAccountHostName
isHttpAllowed: true
isHttpsAllowed: true
queryStringCachingBehavior: 'IgnoreQueryString'
contentTypesToCompress: [
'text/plain'
'text/html'
'text/css'
'application/x-javascript'
'text/javascript'
]
isCompressionEnabled: true
origins: [
{
name: 'origin1'
properties: {
hostName: storageAccountHostName
}
}
]
}
}
output hostName string = endpoint.properties.hostName
output originHostHeader string = endpoint.properties.originHostHeader