本文概述了一系列经过验证的 Web 服务的 FinOps 做法。 它提供优化成本、提高效率和使用 Azure Resource Graph (ARG) 查询来深入了解 Web 资源的策略。 通过遵循这些做法,可以确保 Web 服务经济高效,并与组织的财务目标保持一致。
App Service
以下部分提供了针对 App Service 的 ARG 查询。 这些查询可帮助你获得对 App Service 资源的洞察,并确保它们配置了适当的设置。 通过分析 App 服务计划和从 Azure 顾问获取的建议,可以优化您的 App 服务资源,实现成本效益最大化。
查询:Web 应用程序状态
此 ARG 查询检索 Azure 环境中 Web 应用程序的状态和基本信息。
类别
监控
查询
resources
| where type =~ 'Microsoft.Web/sites'
| project
id,
WebAppName = name,
Type = kind,
Status = tostring(properties.state),
WebAppLocation = location,
AppServicePlan = tostring(properties.serverFarmId),
WebAppRG = resourceGroup,
SubscriptionId = subscriptionId
| order by id asc
删除空的应用服务计划
建议:删除没有托管任何应用或功能的应用服务计划,以避免不必要的费用。
关于空的应用服务计划
应用服务计划定义 Web 应用的计算资源。 无论是否托管任何应用,付费计划都会根据其配置的 SKU 和实例计数产生费用。 空计划可以在开发期间或应用在计划之间移动时累积。 删除未使用的计划可消除不必要的成本。
识别空的应用服务计划
使用以下 ARG 查询识别没有托管应用的应用服务计划。
resources
| where type =~ 'microsoft.web/serverfarms'
| where toint(properties.numberOfSites) == 0
| where sku.tier !~ 'Free'
| project
ResourceId = tolower(id),
ResourceName = name,
SKUName = tostring(sku.name),
SKUTier = tostring(sku.tier),
Region = location,
ResourceGroupName = resourceGroup,
SubscriptionId = subscriptionId
查询:App 服务计划详细信息
此 ARG 查询检索有关 Azure 环境中Azure App 服务计划的详细信息。
类别
资源管理
查询
resources
| where type == "microsoft.web/serverfarms" and sku.tier !~ 'Free'
| project
planId = tolower(tostring(id)),
name,
skuname = tostring(sku.name),
skutier = tostring(sku.tier),
workers = tostring(properties.numberOfWorkers),
maxworkers = tostring(properties.maximumNumberOfWorkers),
webRG = resourceGroup,
Sites = tostring(properties.numberOfSites),
SubscriptionId = subscriptionId
| join kind=leftouter (
resources
| where type == "microsoft.insights/autoscalesettings"
| project
planId = tolower(tostring(properties.targetResourceUri)),
PredictiveAutoscale = properties.predictiveAutoscalePolicy.scaleMode,
AutoScaleProfiles = properties.profiles,
resourceGroup
) on planId
提供反馈
请您给我们一个简短的评价,让我们知道我们做得怎么样。 我们将使用这些评审来改进和扩展 FinOps 工具和资源。
如果您在寻找特定的东西,可以为现有想法投票或者创建新想法。 与他人分享想法,以获得更多的选票。 我们专注于拥有最多选票的想法。
相关内容
相关资源:
相关解决方案: