|
| 1 | +--- |
| 2 | +title: "Quickstart: Connect Service Group members using the REST API - Azure Governance" |
| 3 | +description: In this quickstart, you use REST API to connect a resource to a service group with a service group member relationship. |
| 4 | +author: rthorn17 |
| 5 | +ms.author: rithorn |
| 6 | +ms.service: azure-policy |
| 7 | +ms.topic: quickstart |
| 8 | +ms.date: 5/19/2025 |
| 9 | +--- |
| 10 | + |
| 11 | + |
| 12 | +# Quickstart: Connect resources or resource containers to service groups with Service Group Member Relationships |
| 13 | + |
| 14 | +To connect resources, resource groups, or subscriptions to a Service Group (preview), you need to create a new Service Group Member Relationship. For more information on service groups, see [Getting started with Service Groups](overview.md). |
| 15 | + |
| 16 | +> [!IMPORTANT] |
| 17 | +> Azure Service Groups is currently in PREVIEW. |
| 18 | +> For more information about participating in the preview, see [Azure Service Groups Preview](https://aka.ms/ServiceGroups/PreviewSignup). |
| 19 | +> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. |
| 20 | +
|
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +- If you don't have an Azure subscription, create a [free](https://azure.microsoft.com/free/) |
| 24 | + account before you begin. |
| 25 | + |
| 26 | +- If you haven't already, install [ARMClient](https://github.com/projectkudu/ARMClient). It's a tool |
| 27 | + that sends HTTP requests to Azure Resource Manager-based REST APIs. |
| 28 | + |
| 29 | +## Create in REST API |
| 30 | + |
| 31 | +For REST API, use the |
| 32 | +[Service Groups Member- Create or Update]() endpoint to create a new service group member. |
| 33 | + |
| 34 | +In this example, we're connecting a Virtual Machine [VM1] to a service group [Contoso]. |
| 35 | + |
| 36 | +1. Service Group: **groupId** is _Contoso_ |
| 37 | +1. Virtual Machine: The **resourceID** is _VM1_ |
| 38 | +1. Service Group Member: The **relationshipID** is _SGM1_ |
| 39 | + |
| 40 | +When you're adding a resource to a service group, you create service group member by extending the resource. |
| 41 | + |
| 42 | +- REST API URI |
| 43 | + |
| 44 | + ```http |
| 45 | + PUT https://management.azure.com/[scope]/providers/Microsoft.Relationships/serviceGroupMember/SGM1?api-version=2023-09-01-preview |
| 46 | + ``` |
| 47 | + |
| 48 | + |
| 49 | +In the preceding example, the new service group member is created extending the Virtual Machine. To |
| 50 | +specify the service group as the parent, use the **TargetID** property. |
| 51 | + |
| 52 | +- REST API URI |
| 53 | + |
| 54 | + ```http |
| 55 | + PUT https://management.azure.com/subscriptions/[SUBID]/resourceGroups/[RGID]/providers/microsoft.compute/virtualmachine/[VMID]/providers/Microsoft.Relationships/serviceGroupMember/SGM1?api-version=2024-02-01-preview |
| 56 | + ``` |
| 57 | + |
| 58 | +- Request Body |
| 59 | + |
| 60 | + ```json |
| 61 | + { |
| 62 | + "properties": { |
| 63 | + "targetId": "providers/microsoft.management/servicegroups/Contoso" |
| 64 | + } |
| 65 | + } |
| 66 | + ``` |
| 67 | + |
| 68 | +## Clean up resources |
| 69 | + |
| 70 | +To remove the service group created in this document, use the |
| 71 | +[Service Group Member Delete]() endpoint: |
| 72 | + |
| 73 | +- REST API URI |
| 74 | + |
| 75 | + ```http |
| 76 | + DELETE https://management.azure.com/[scope]/providers/Microsoft.Relationships/serviceGroupMember/SGM1?api-version=2023-09-01-preview |
| 77 | + ``` |
| 78 | + |
| 79 | +- No Request Body |
| 80 | + |
| 81 | + |
| 82 | +## Next step |
| 83 | + |
| 84 | +In this quickstart, you created a service group to help create different views in Azure. The |
| 85 | +service group can have member subscriptions, resource groups, resources, or other service groups. |
| 86 | + |
| 87 | +To learn more about service groups and how to manage your service group hierarchy, continue to: |
| 88 | + |
| 89 | +> [!div class="nextstepaction"] |
| 90 | +> [Manage your resources with service groups](manage-service-groups.md) |
| 91 | +
|
0 commit comments