本文概述網路服務的已實證 FinOps 做法。 他們著重於成本優化、效率改善和資源深入解析。
Azure 防火牆
下列各節提供適用於 Azure 防火牆 的 Azure Resource Graph (ARG) 查詢。 這些查詢可協助您深入瞭解 Azure 防火牆資源,並確保其已設定適當的設定。 藉由分析 Azure Advisor 的使用模式和呈現建議,您可以將 Azure 防火牆設定優化,以達到成本效益。
查詢:Azure 防火牆和防火牆原則分析
此 ARG 查詢會分析 Azure 防火牆及其 Azure 環境中的相關聯防火牆原則。 它特別以具有進階 SKU 層的防火牆為目標,並確認其相關聯防火牆原則中的設定正在使用進階功能。
類別
最佳化
查詢
resources
| where type =~ 'Microsoft.Network/azureFirewalls' and properties.sku.tier=="Premium"
| project FWID=id, firewallName=name, SkuTier=tostring(properties.sku.tier), resourceGroup, location
| join kind=inner (
resources
| where type =~ 'microsoft.network/firewallpolicies'
| mv-expand properties.firewalls
| extend intrusionDetection = tostring(properties.intrusionDetection contains "Alert"
or properties.intrusionDetection contains "Deny")
| extend transportSecurity = tostring(properties.transportSecurity contains "keyVaultSecretId")
| extend FWID = tostring(properties_firewalls.id)
| where intrusionDetection == "False"
and transportSecurity == "False"
| project
PolicyName = name,
PolicySKU = tostring(properties.sku.tier),
intrusionDetection,
transportSecurity,
FWID
) on FWID
查詢:Azure 防火牆 和相關聯的子網分析
此 ARG 查詢會分析 Azure 防火牆及其 Azure 環境中的相關聯子網。 它提供有關哪些子網與每個 Azure 防火牆實例相關聯的深入見解。 將 Azure 防火牆置於中樞虛擬網路或虛擬 WAN 安全中樞的中央實例,可優化 Azure 防火牆的使用。 然後在從相同區域連線到相同中樞的許多輪輻虛擬網路之間共用相同的防火牆。
類別
最佳化
查詢
resources
| where type =~ 'Microsoft.Network/azureFirewalls' and properties.sku.tier=="Premium"
| project
FWID=id,
firewallName=name,
SkuTier=tostring(properties.sku.tier),
resourceGroup,
location
| join kind=inner (
resources
| where type =~ 'microsoft.network/firewallpolicies'
| mv-expand properties.firewalls
| extend intrusionDetection = tostring(properties.intrusionDetection contains "Alert"
or properties.intrusionDetection contains "Deny")
| extend transportSecurity = tostring(properties.transportSecurity contains "keyVaultSecretId")
| extend FWID=tostring(properties_firewalls.id)
| where intrusionDetection == "False"
and transportSecurity == "False"
| project
PolicyName = name,
PolicySKU = tostring(properties.sku.tier),
intrusionDetection,
transportSecurity,
FWID
) on FWID
應用程式閘道
以下段落提供一個針對 Azure 應用程式閘道的 ARG 查詢。 其可協助您深入瞭解 Azure 應用程式閘道 資源,並確保它們已使用適當的設定進行設定。
查詢:閒置的應用閘道
此 ARG 查詢會分析 Azure 環境中的應用程式閘道及其相關聯的後端集區。 它提供對於哪些應用程式閘道具有空後端集區的見解,指出它們可能閒置並且可能不必要。
類別
最佳化
查詢
resources
| where type =~ 'Microsoft.Network/applicationGateways'
| extend
backendPoolsCount = array_length(properties.backendAddressPools),
SKUName = tostring(properties.sku.name),
SKUTier = tostring(properties.sku.tier),
SKUCapacity = properties.sku.capacity,
backendPools = properties.backendAddressPools,
resourceGroup = strcat('/subscriptions/',subscriptionId,'/resourceGroups/',resourceGroup)
| project id, name, SKUName, SKUTier, SKUCapacity, resourceGroup, subscriptionId
| join (
resources
| where type =~ 'Microsoft.Network/applicationGateways'
| mvexpand backendPools = properties.backendAddressPools
| extend backendIPCount = array_length(backendPools.properties.backendIPConfigurations)
| extend backendAddressesCount = array_length(backendPools.properties.backendAddresses)
| extend backendPoolName = backendPools.properties.backendAddressPools.name
| summarize
backendIPCount = sum(backendIPCount),
backendAddressesCount = sum(backendAddressesCount)
by id
) on id
| project-away id1
| where (backendIPCount == 0 or isempty(backendIPCount))
and (backendAddressesCount==0 or isempty(backendAddressesCount))
| order by id asc
ExpressRoute
下一節提供 ExpressRoute 的 ARG 查詢。 其可協助您深入瞭解 ExpressRoute 線路,並確保它們已使用適當的設定進行設定。
查詢:閒置的 ExpressRoute 電路
此 ARG 查詢會分析 Azure 環境中的 ExpressRoute 線路,以識別任何沒有完成線路的線路。
類別
最佳化
查詢
resources
| where type =~ 'Microsoft.Network/expressRouteCircuits'
and properties.serviceProviderProvisioningState == "NotProvisioned"
| extend
ServiceLocation = tostring(properties.serviceProviderProperties.peeringLocation),
ServiceProvider = tostring(properties.serviceProviderProperties.serviceProviderName),
BandwidthInMbps = tostring(properties.serviceProviderProperties.bandwidthInMbps)
| project
ERId = id,
ERName = name,
ERRG = resourceGroup,
SKUName = tostring(sku.name),
SKUTier = tostring(sku.tier),
SKUFamily = tostring(sku.family),
ERLocation = location,
ServiceLocation,
ServiceProvider,
BandwidthInMbps
負載平衡器
下一節提供 Azure Load Balancer 的 ARG 查詢。 其可協助您深入瞭解您的 Azure 負載平衡器資源,並確保它們已使用適當的設定進行設定。
查詢:閒置負載平衡器
此 ARG 查詢會分析 Azure 負載平衡器及其 Azure 環境中的相關聯後端集區。 它提供資訊,讓使用者了解哪些負載平衡器的後端集區是空的,指出它們可能閒置且潛在地不必要。
類別
最佳化
查詢
resources
| extend resourceGroup = strcat('/subscriptions/', subscriptionId, '/resourceGroups/', resourceGroup)
| extend SKUName = tostring(sku.name)
| extend SKUTier = tostring(sku.tier)
| extend location,backendAddressPools = properties.backendAddressPools
| where type =~ 'microsoft.network/loadbalancers'
and array_length(backendAddressPools) == 0
and sku.name!='Basic'
| order by id asc
| project
id,
name,
SKUName,
SKUTier,
backendAddressPools,
location,
resourceGroup,
subscriptionId
私人 DNS
下一節提供 私用 DNS 的 ARG 查詢。 其可協助您深入瞭解 私用 DNS 資源,並確保這些資源已使用適當的設定進行設定。
查詢:私用 DNS
此 ARG 查詢會分析 Azure 環境中 私用 DNS 區域,以識別任何沒有 虛擬網絡 連結的區域。
類別
最佳化
查詢
resources
| where type == "microsoft.network/privatednszones"
and properties.numberOfVirtualNetworkLinks == 0
| project id, PrivateDNSName=name,
NumberOfRecordSets = tostring(properties.numberOfRecordSets),
resourceGroup = tostring(strcat('/subscriptions/', subscriptionId, '/resourceGroups/', resourceGroup)),
vNets = tostring(properties.properties.numberOfVirtualNetworkLinks),
subscriptionId
公用 IP 位址
下列各節提供公用IP位址的ARG查詢。 它們可協助您深入瞭解您的公用IP位址資源,並確保它們已使用適當的設定進行設定。
查詢:閑置公用IP位址
此 ARG 查詢會分析 Azure 公用 IP 位址。 它提供公用 IP 中哪些是閒置且可能不必要的見解。
類別
最佳化
查詢
resources
| where type =~ 'Microsoft.Network/publicIPAddresses'
and isempty(properties.ipConfiguration)
and isempty(properties.natGateway)
and properties.publicIPAllocationMethod =~ 'Static'
| extend
PublicIpId = id,
IPName = name,
AllocationMethod = tostring(properties.publicIPAllocationMethod),
SKUName = sku.name,
Location = location,
resourceGroup = strcat('/subscriptions/', subscriptionId, '/resourceGroups/', resourceGroup)
| project PublicIpId, IPName, SKUName, resourceGroup, Location, AllocationMethod, subscriptionId
| union (
Resources
| where type =~ 'microsoft.network/networkinterfaces'
and isempty(properties.virtualMachine)
and isnull(properties.privateEndpoint)
and isnotempty(properties.ipConfigurations)
| extend IPconfig = properties.ipConfigurations
| mv-expand IPconfig
| extend PublicIpId= tostring(IPconfig.properties.publicIPAddress.id)
| project PublicIpId
| join (
resource
| where type =~ 'Microsoft.Network/publicIPAddresses'
| extend
PublicIpId = id,
IPName = name,
AllocationMethod = tostring(properties.publicIPAllocationMethod),
SKUName = sku.name,
resourceGroup,
Location = location
) on PublicIpId
| project
PublicIpId,
IPName,
SKUName,
resourceGroup,
Location,
AllocationMethod,
subscriptionId
)
查詢:識別公用IP位址路由方法
此 ARG 查詢會分析公用 IP 位址,並識別路由方法、配置方法和 SKU。 它也會分析與IP組態相關聯的公用IP位址的其他詳細數據。
類別
最佳化
查詢
resources
| where type =~ 'Microsoft.Network/publicIPAddresses'
and isnotempty(properties.ipConfiguration)
| where tostring(properties.ipTags) == "[]"
| extend
PublicIpId = id,
RoutingMethod = id,
IPName = name,
AllocationMethod = tostring(properties.publicIPAllocationMethod),
SKUName = sku.name,
Location = location,
resourceGroup = strcat('/subscriptions/', subscriptionId, '/resourceGroups/', resourceGroup)
| project
PublicIpId,
IPName,
RoutingMethod,SKUName,
resourceGroup,
Location,
AllocationMethod,
subscriptionId
查詢:檢查公用IP位址的 DDoS 保護原則
如果您需要保護少於15個公用IP資源,IP保護層是更具成本效益的選項。 不過,如果您有15個以上的公用IP資源來保護,則網路保護層會變得更符合成本效益。
類別
最佳化
查詢
resources
| where type == "microsoft.network/publicipaddresses"
| project ddosProtection = tostring(properties.ddosSettings), name
| where ddosProtection has "Enabled"
| count
| project TotalIpsProtected = Count
| extend CheckIpsProtected = iff(TotalIpsProtected >= 15, "Enable Network Protection tier", "Enable PIP DDoS Protection")
虛擬網路閘道
下列各節提供 虛擬網絡 閘道的ARG查詢。 它們可協助您深入瞭解 虛擬網絡 閘道資源,並確保它們已使用適當的設定進行設定。
查詢:檢測閒置狀況的虛擬網路閘道
此 ARG 查詢會分析 Azure 環境中 虛擬網絡 閘道,以識別任何閒置的閘道。
類別
最佳化
查詢
resources
| where type == "microsoft.network/virtualnetworkgateways"
| extend resourceGroup = strcat('/subscriptions/', subscriptionId, '/resourceGroups/', resourceGroup)
| project id, GWName=name, resourceGroup, location, subscriptionId
| join kind = leftouter(
resources
| where type == "microsoft.network/connections"
| extend id = tostring(properties.virtualNetworkGateway1.id)
| project id
) on id
| where isempty(id1)
| project
id,
GWName,
resourceGroup,
location,
subscriptionId,
status=id
查詢:檢查閑置 NAT 閘道
此 ARG 查詢會分析 Azure 環境中的 NAT 閘道,以識別任何閒置的閘道。
類別
最佳化
查詢
resources
| where type == "microsoft.network/natgateways" and isnull(properties.subnets)
| project
id,
GWName = name,
SKUName = tostring(sku.name),
SKUTier = tostring(sku.tier),
Location = location,
resourceGroup = tostring(strcat('/subscriptions/', subscriptionId, '/resourceGroups/', resourceGroup)),
subnet = tostring(properties.subnet),
subscriptionId
提供意見反應
請寫下您的快速評價,讓我們知道我們的表現如何。 我們會使用這些評論來改善及擴充 FinOps 工具和資源。
如果您要尋找特定專案,請投票給現有專案或建立新想法。 與其他人分享想法,以獲得更多的選票。 我們專注於擁有最多選票的想法。
相關內容
相關資源:
相關解決方案: