Skip to content

Commit fa4ae3e

Browse files
authored
Update service-groups.md
1 parent 78f5681 commit fa4ae3e

File tree

1 file changed

+1
-78
lines changed

1 file changed

+1
-78
lines changed

articles/governance/resource-graph/includes/samples-by-category/service-groups.md

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.date: 06/20/2025
66
ms.author: kenieva
77
---
88

9-
### List of all Service Group
9+
### List of all Service Groups
1010

1111
Outputs a list of Service Groups.
1212

@@ -90,80 +90,3 @@ Search-AzGraph -Query "relationshipresources| where type == 'microsoft.relations
9090
- Azure portal: <a href="https://portal.azure.com/#blade/HubsExtension/ArgQueryBlade/query/relationshipresources%7C%20where%20type%20%3D%3D%20'microsoft.relationships%2Fservicegroupmember'%7C%20where%20properties.TargetId%20%3D%3D%20'%2Fproviders%2FMicrosoft.Management%2FserviceGroups%2F123'%20%7C%20count" target="_blank">portal.azure.com</a>
9191

9292
---
93-
94-
### Count members per Service Group
95-
96-
Provides the number of relationships per existing Service Group.
97-
98-
```kusto
99-
resourcecontainers
100-
| where type == "microsoft.management/servicegroups"
101-
| project SGName = ['id']
102-
| join kind=inner (
103-
    relationshipresources
104-
    | where type == "microsoft.relationships/servicegroupmember"
105-
    | project TargetID = tostring(properties.TargetId), relationshipid = tostring(id)
106-
) on $left.SGName == $right.TargetID
107-
|project SGName, relationshipid
108-
```
109-
110-
# [Azure CLI](#tab/azure-cli)
111-
112-
```azurecli-interactive
113-
az graph query -q "ResourceContainers | where type =~ 'microsoft.resources/subscriptions' | extend mgParent = properties.managementGroupAncestorsChain | mv-expand with_itemindex=MGHierarchy mgParent | project subscriptionId, name, mgParent, MGHierarchy, mgParent.name" --subscriptions 11111111-1111-1111-1111-111111111111
114-
```
115-
116-
# [Azure PowerShell](#tab/azure-powershell)
117-
118-
```azurepowershell-interactive
119-
Search-AzGraph -Query "ResourceContainers | where type =~ 'microsoft.resources/subscriptions' | extend mgParent = properties.managementGroupAncestorsChain | mv-expand with_itemindex=MGHierarchy mgParent | project subscriptionId, name, mgParent, MGHierarchy, mgParent.name" -Subscription 11111111-1111-1111-1111-111111111111
120-
```
121-
122-
# [Portal](#tab/azure-portal)
123-
124-
125-
126-
- Azure portal: <a href="https://portal.azure.com/#blade/HubsExtension/ArgQueryBlade/query/ResourceContainers%0a%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%27%0a%7c%20extend%20%20mgParent%20%3d%20properties.managementGroupAncestorsChain%0a%7c%20mv-expand%20with_itemindex%3dMGHierarchy%20mgParent%0a%7c%20project%20subscriptionId%2c%20name%2c%20mgParent%2c%20MGHierarchy%2c%20mgParent.name" target="_blank">portal.azure.com</a>
127-
- Azure Government portal: <a href="https://portal.azure.us/#blade/HubsExtension/ArgQueryBlade/query/ResourceContainers%0a%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%27%0a%7c%20extend%20%20mgParent%20%3d%20properties.managementGroupAncestorsChain%0a%7c%20mv-expand%20with_itemindex%3dMGHierarchy%20mgParent%0a%7c%20project%20subscriptionId%2c%20name%2c%20mgParent%2c%20MGHierarchy%2c%20mgParent.name" target="_blank">portal.azure.us</a>
128-
- Azure operated by 21Vianet portal: <a href="https://portal.azure.cn/#blade/HubsExtension/ArgQueryBlade/query/ResourceContainers%0a%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%27%0a%7c%20extend%20%20mgParent%20%3d%20properties.managementGroupAncestorsChain%0a%7c%20mv-expand%20with_itemindex%3dMGHierarchy%20mgParent%0a%7c%20project%20subscriptionId%2c%20name%2c%20mgParent%2c%20MGHierarchy%2c%20mgParent.name" target="_blank">portal.azure.cn</a>
129-
130-
---
131-
132-
### Count Membership of Service Group per resource
133-
134-
Provides the number of relationships per existing Service Group.
135-
136-
```kusto
137-
resourcecontainers
138-
| where type == "microsoft.management/servicegroups"
139-
| project SGName = ['id']
140-
| join kind=inner (
141-
    relationshipresources
142-
    | where type == "microsoft.relationships/servicegroupmember"
143-
    | project TargetID = tostring(properties.TargetId), relationshipid = tostring(id)
144-
) on $left.SGName == $right.TargetID
145-
|project SGName, relationshipid
146-
```
147-
148-
# [Azure CLI](#tab/azure-cli)
149-
150-
```azurecli-interactive
151-
az graph query -q "ResourceContainers | where type =~ 'microsoft.resources/subscriptions' | extend mgParent = properties.managementGroupAncestorsChain | mv-expand with_itemindex=MGHierarchy mgParent | project subscriptionId, name, mgParent, MGHierarchy, mgParent.name" --subscriptions 11111111-1111-1111-1111-111111111111
152-
```
153-
154-
# [Azure PowerShell](#tab/azure-powershell)
155-
156-
```azurepowershell-interactive
157-
Search-AzGraph -Query "ResourceContainers | where type =~ 'microsoft.resources/subscriptions' | extend mgParent = properties.managementGroupAncestorsChain | mv-expand with_itemindex=MGHierarchy mgParent | project subscriptionId, name, mgParent, MGHierarchy, mgParent.name" -Subscription 11111111-1111-1111-1111-111111111111
158-
```
159-
160-
# [Portal](#tab/azure-portal)
161-
162-
163-
164-
- Azure portal: <a href="https://portal.azure.com/#blade/HubsExtension/ArgQueryBlade/query/ResourceContainers%0a%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%27%0a%7c%20extend%20%20mgParent%20%3d%20properties.managementGroupAncestorsChain%0a%7c%20mv-expand%20with_itemindex%3dMGHierarchy%20mgParent%0a%7c%20project%20subscriptionId%2c%20name%2c%20mgParent%2c%20MGHierarchy%2c%20mgParent.name" target="_blank">portal.azure.com</a>
165-
- Azure Government portal: <a href="https://portal.azure.us/#blade/HubsExtension/ArgQueryBlade/query/ResourceContainers%0a%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%27%0a%7c%20extend%20%20mgParent%20%3d%20properties.managementGroupAncestorsChain%0a%7c%20mv-expand%20with_itemindex%3dMGHierarchy%20mgParent%0a%7c%20project%20subscriptionId%2c%20name%2c%20mgParent%2c%20MGHierarchy%2c%20mgParent.name" target="_blank">portal.azure.us</a>
166-
- Azure operated by 21Vianet portal: <a href="https://portal.azure.cn/#blade/HubsExtension/ArgQueryBlade/query/ResourceContainers%0a%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%27%0a%7c%20extend%20%20mgParent%20%3d%20properties.managementGroupAncestorsChain%0a%7c%20mv-expand%20with_itemindex%3dMGHierarchy%20mgParent%0a%7c%20project%20subscriptionId%2c%20name%2c%20mgParent%2c%20MGHierarchy%2c%20mgParent.name" target="_blank">portal.azure.cn</a>
167-
168-
---
169-

0 commit comments

Comments
 (0)