![](/img/trans.png)
[英]Is there a way to connect an Azure firewall to a Front Door Premium Policy with Bicep?
[英]How to activate compression for Azure Front Door routes using Bicep?
我正在使用 Azure Front Door Standard/Premium,並且已經通過 Azure 門戶手動為我的 UI 路由啟用壓縮。 我想 map 這個配置作為 IaC with Bicep。 但是,沒有關於如何執行此操作的適當文檔。 我的嘗試:
compressionSettings: any()
的引用,其用法未進一步指定。compressionSettings
屬性始終保留值{}
。 如果我使用值compressionSettings: {}
部署我的二頭肌模板,則門戶中的壓縮將保持禁用狀態。那么如何使用 Bicep 為 Azure Front Door 啟用壓縮?
我通過在 azure-quickstart-templates 中手動搜索找到了解決方案。 在頁面底部: Microsoft.Cdn profiles/afdEndpoints/routes 2020-09-01 ,我找到了模板Front Door Standard/Premium 。 分析完這里的main.bicep
文件,壓縮設置必須設置如下:
compressionSettings: {
contentTypesToCompress: [
'application/javascript'
'application/json'
'font/woff'
'font/woff2'
'image/svg+xml'
'image/x-icon'
'text/css'
'text/html'
]
isCompressionEnabled: true
}
在我整個代碼的一部分中,它看起來像這樣:
var contentTypesToCompress = [
'application/javascript'
'application/json'
'font/woff'
'font/woff2'
'image/svg+xml'
'image/x-icon'
'text/css'
'text/html'
]
resource profile 'Microsoft.Cdn/profiles@2020-09-01' = {
name: 'frontDoor'
location: 'global'
sku: {
name: 'Premium_AzureFrontDoor'
}
tags: tags
}
resource endpoint 'Microsoft.Cdn/profiles/afdEndpoints@2020-09-01' = {
parent: profile
name: 'endpoint'
location: 'Global'
tags: tags
properties: {
originResponseTimeoutSeconds: 60
enabledState: 'Enabled'
}
}
resource route 'Microsoft.Cdn/profiles/afdEndpoints/routes@2020-09-01' = {
parent: endpoint
name: 'route'
properties: {
queryStringCachingBehavior: 'IgnoreQueryString'
compressionSettings: {
contentTypesToCompress: contentTypesToCompress
isCompressionEnabled: true
}
...
}
dependsOn: [
profile
]
}
由於到目前為止還沒有在任何地方真正記錄下來,我認為在這里以問答形式分享它會很有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.