Skip to content

Commit 4d689c5

Browse files
authored
Merge pull request #286464 from jasongroce/main
Adding samples by category information back to active repo
2 parents 3dbbfc3 + 0b2d53b commit 4d689c5

File tree

48 files changed

+5158
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5158
-7
lines changed

articles/governance/resource-graph/.openpublishing.redirection.resource-graph.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@
3535
"redirect_url": "/azure/governance/resource-graph/first-query-powershell",
3636
"redirect_document_id": false
3737
},
38-
{
39-
"source_path_from_root": "/articles/governance/resource-graph/samples/samples-by-category.md",
40-
"redirect_url": "/previous-versions/azure/governance/resource-graph/samples/samples-by-category",
41-
"redirect_document_id": false
42-
},
4338
{
4439
"source_path_from_root": "/articles/governance/resource-graph/samples/samples-by-table.md",
4540
"redirect_url": "/previous-versions/azure/governance/resource-graph/samples/samples-by-table",
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
author: jaspkaur28
3+
ms.service: resource-graph
4+
ms.topic: include
5+
ms.date: 07/07/2022
6+
ms.author: jaspkaur
7+
---
8+
9+
### Get cost savings summary from Azure Advisor
10+
11+
This query summarizes the cost savings of each [Azure Advisor](/azure/advisor/advisor-overview) recommendation.
12+
13+
```kusto
14+
AdvisorResources
15+
| where type == 'microsoft.advisor/recommendations'
16+
| where properties.category == 'Cost'
17+
| extend
18+
resources = tostring(properties.resourceMetadata.resourceId),
19+
savings = todouble(properties.extendedProperties.savingsAmount),
20+
solution = tostring(properties.shortDescription.solution),
21+
currency = tostring(properties.extendedProperties.savingsCurrency)
22+
| summarize
23+
dcount(resources),
24+
bin(sum(savings), 0.01)
25+
by solution, currency
26+
| project solution, dcount_resources, sum_savings, currency
27+
| order by sum_savings desc
28+
```
29+
30+
# [Azure CLI](#tab/azure-cli)
31+
32+
```azurecli-interactive
33+
az graph query -q "AdvisorResources | where type == 'microsoft.advisor/recommendations' | where properties.category == 'Cost' | extend resources = tostring(properties.resourceMetadata.resourceId), savings = todouble(properties.extendedProperties.savingsAmount), solution = tostring(properties.shortDescription.solution), currency = tostring(properties.extendedProperties.savingsCurrency) | summarize dcount(resources), bin(sum(savings), 0.01) by solution, currency | project solution, dcount_resources, sum_savings, currency | order by sum_savings desc"
34+
```
35+
36+
# [Azure PowerShell](#tab/azure-powershell)
37+
38+
```azurepowershell-interactive
39+
Search-AzGraph -Query "AdvisorResources | where type == 'microsoft.advisor/recommendations' | where properties.category == 'Cost' | extend resources = tostring(properties.resourceMetadata.resourceId), savings = todouble(properties.extendedProperties.savingsAmount), solution = tostring(properties.shortDescription.solution), currency = tostring(properties.extendedProperties.savingsCurrency) | summarize dcount(resources), bin(sum(savings), 0.01) by solution, currency | project solution, dcount_resources, sum_savings, currency | order by sum_savings desc"
40+
```
41+
42+
# [Portal](#tab/azure-portal)
43+
44+
45+
46+
- Azure portal: <a href="https://portal.azure.com/#blade/HubsExtension/ArgQueryBlade/query/AdvisorResources%0a%7c%20where%20type%20%3d%3d%20%27microsoft.advisor%2frecommendations%27%0a%7c%20where%20properties.category%20%3d%3d%20%27Cost%27%0a%7c%20extend%0a%09resources%20%3d%20tostring(properties.resourceMetadata.resourceId)%2c%0a%09savings%20%3d%20todouble(properties.extendedProperties.savingsAmount)%2c%0a%09solution%20%3d%20tostring(properties.shortDescription.solution)%2c%0a%09currency%20%3d%20tostring(properties.extendedProperties.savingsCurrency)%0a%7c%20summarize%0a%09dcount(resources)%2c%0a%09bin(sum(savings)%2c%200.01)%0a%09by%20solution%2c%20currency%0a%7c%20project%20solution%2c%20dcount_resources%2c%20sum_savings%2c%20currency%0a%7c%20order%20by%20sum_savings%20desc" target="_blank">portal.azure.com</a>
47+
- Azure Government portal: <a href="https://portal.azure.us/#blade/HubsExtension/ArgQueryBlade/query/AdvisorResources%0a%7c%20where%20type%20%3d%3d%20%27microsoft.advisor%2frecommendations%27%0a%7c%20where%20properties.category%20%3d%3d%20%27Cost%27%0a%7c%20extend%0a%09resources%20%3d%20tostring(properties.resourceMetadata.resourceId)%2c%0a%09savings%20%3d%20todouble(properties.extendedProperties.savingsAmount)%2c%0a%09solution%20%3d%20tostring(properties.shortDescription.solution)%2c%0a%09currency%20%3d%20tostring(properties.extendedProperties.savingsCurrency)%0a%7c%20summarize%0a%09dcount(resources)%2c%0a%09bin(sum(savings)%2c%200.01)%0a%09by%20solution%2c%20currency%0a%7c%20project%20solution%2c%20dcount_resources%2c%20sum_savings%2c%20currency%0a%7c%20order%20by%20sum_savings%20desc" target="_blank">portal.azure.us</a>
48+
- Microsoft Azure operated by 21Vianet portal: <a href="https://portal.azure.cn/#blade/HubsExtension/ArgQueryBlade/query/AdvisorResources%0a%7c%20where%20type%20%3d%3d%20%27microsoft.advisor%2frecommendations%27%0a%7c%20where%20properties.category%20%3d%3d%20%27Cost%27%0a%7c%20extend%0a%09resources%20%3d%20tostring(properties.resourceMetadata.resourceId)%2c%0a%09savings%20%3d%20todouble(properties.extendedProperties.savingsAmount)%2c%0a%09solution%20%3d%20tostring(properties.shortDescription.solution)%2c%0a%09currency%20%3d%20tostring(properties.extendedProperties.savingsCurrency)%0a%7c%20summarize%0a%09dcount(resources)%2c%0a%09bin(sum(savings)%2c%200.01)%0a%09by%20solution%2c%20currency%0a%7c%20project%20solution%2c%20dcount_resources%2c%20sum_savings%2c%20currency%0a%7c%20order%20by%20sum_savings%20desc" target="_blank">portal.azure.cn</a>
49+
50+
---

0 commit comments

Comments
 (0)