|
| 1 | +--- |
| 2 | +author: kenieva |
| 3 | +ms.service: resource-graph |
| 4 | +ms.topic: include |
| 5 | +ms.date: 06/20/2025 |
| 6 | +ms.author: kenieva |
| 7 | +--- |
| 8 | + |
| 9 | +### List of all Service Groups |
| 10 | + |
| 11 | +Outputs a list of Service Groups. |
| 12 | + |
| 13 | +```kusto |
| 14 | +resourcecontainers |
| 15 | +| where type == "microsoft.management/servicegroups" |
| 16 | +``` |
| 17 | + |
| 18 | +# [Azure CLI](#tab/azure-cli) |
| 19 | + |
| 20 | +```azurecli-interactive |
| 21 | +az graph query -q "resourcecontainers | where type == 'microsoft.management/servicegroups'" |
| 22 | +``` |
| 23 | + |
| 24 | +# [Azure PowerShell](#tab/azure-powershell) |
| 25 | + |
| 26 | +```azurepowershell-interactive |
| 27 | +Search-AzGraph -Query "resourcecontainers | where type == 'microsoft.management/servicegroups'" -UseTenantScope |
| 28 | +``` |
| 29 | + |
| 30 | +# [Portal](#tab/azure-portal) |
| 31 | + |
| 32 | +- Azure portal: <a>[portal.azure.com](https://portal.azure.com/#view/HubsExtension/ArgQueryBlade/query/resourcecontainers%0A%7C%20where%20type%20%3D%3D%20%22microsoft.management%2Fservicegroups%22)</a> |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +### List of all members for a particular Service Group |
| 37 | + |
| 38 | +Outputs a list of resource IDs that are members for a particular Service Groups. In this example, the service group ID is '123'. |
| 39 | + |
| 40 | +```kusto |
| 41 | +relationshipresources |
| 42 | + | where type == "microsoft.relationships/servicegroupmember" |
| 43 | + | where properties.TargetId == '/providers/Microsoft.Management/serviceGroups/123' |
| 44 | + | project properties.SourceId |
| 45 | +``` |
| 46 | + |
| 47 | +# [Azure CLI](#tab/azure-cli) |
| 48 | + |
| 49 | +```azurecli-interactive |
| 50 | +az graph query -q "relationshipresources| where type == 'microsoft.relationships/servicegroupmember'| where properties.TargetId == '/providers/Microsoft.Management/serviceGroups/123' | project properties.SourceId" |
| 51 | +``` |
| 52 | + |
| 53 | +# [Azure PowerShell](#tab/azure-powershell) |
| 54 | + |
| 55 | +```azurepowershell-interactive |
| 56 | +Search-AzGraph -Query "relationshipresources| where type == 'microsoft.relationships/servicegroupmember'| where properties.TargetId == '/providers/Microsoft.Management/serviceGroups/123' | project properties.SourceId" -UseTenantScope |
| 57 | +``` |
| 58 | + |
| 59 | +# [Portal](#tab/azure-portal) |
| 60 | + |
| 61 | +- Azure portal: <a>[portal.azure.com](https://portal.azure.com/#view/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%20project%20properties.SourceId)</a> |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +### Count of Members for all Service Groups |
| 66 | + |
| 67 | +Provides a count of service group members for a particular service group. In this example, the service group ID is '123'. |
| 68 | + |
| 69 | +```kusto |
| 70 | +relationshipresources |
| 71 | + | where type == "microsoft.relationships/servicegroupmember" |
| 72 | + | where properties.TargetId == '/providers/Microsoft.Management/serviceGroups/123' |
| 73 | + | count |
| 74 | +``` |
| 75 | + |
| 76 | +# [Azure CLI](#tab/azure-cli) |
| 77 | + |
| 78 | +```azurecli-interactive |
| 79 | +az graph query -q "relationshipresources| where type == 'microsoft.relationships/servicegroupmember'| where properties.TargetId == '/providers/Microsoft.Management/serviceGroups/123' | count" |
| 80 | +``` |
| 81 | + |
| 82 | +# [Azure PowerShell](#tab/azure-powershell) |
| 83 | + |
| 84 | +```azurepowershell-interactive |
| 85 | +Search-AzGraph -Query "relationshipresources| where type == 'microsoft.relationships/servicegroupmember'| where properties.TargetId == '/providers/Microsoft.Management/serviceGroups/123' | count" -UseTenantScope |
| 86 | +``` |
| 87 | + |
| 88 | +# [Portal](#tab/azure-portal) |
| 89 | + |
| 90 | +- Azure portal: <a>[portal.azure.com](https://portal.azure.com/#view/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)</a> |
| 91 | + |
| 92 | +--- |
0 commit comments