网络方面的 FinOps 最佳做法
本文概述了网络服务的经验证的 FinOps 做法。 他们专注于成本优化、效率改进和资源见解。
Azure 防火墙
以下部分提供用于Azure 防火墙的 Azure Resource Graph (ARG) 查询。 这些查询可帮助你深入了解 Azure 防火墙资源,并确保这些资源配置了适当的设置。 通过分析 Azure 顾问的使用情况模式和呈现建议,可以优化 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 负载均衡器的 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
正在查找更多内容?
我们错过了什么吗? 是否希望看到添加的内容? 我们非常想了解你希望在此处介绍的任何问题、问题或解决方案。 创建一个新问题 ,其中包含要在此处查看的详细信息。
相关内容
相关资源:
相关解决方案: