|
| 1 | +--- |
| 2 | +title: "Quickstart: Create a service group with REST API" |
| 3 | +description: In this quickstart, you use REST API to create a service group to organize your resources. |
| 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: Create a service group (preview) with REST API |
| 13 | + |
| 14 | +With Azure Service Groups (preview) you can create low-privilege-based groupings of resources across subscriptions. They provide a way to manage resources with minimal permissions, ensuring that resources can be grouped and managed without granting excessive access. Service Groups are designed to complement existing organizational structures like Resource Groups, Subscriptions, and Management Groups by offering a flexible and secure way to aggregate resources for specific purposes. 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. For more information about participating in the preview, see [TBD Link](). |
| 18 | +> 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. |
| 19 | +
|
| 20 | +## Prerequisites |
| 21 | + |
| 22 | +- If you don't have an Azure subscription, create a [free](https://azure.microsoft.com/free/) |
| 23 | + account before you begin. |
| 24 | + |
| 25 | +- If you haven't already, install [ARMClient](https://github.com/projectkudu/ARMClient). It's a tool |
| 26 | + that sends HTTP requests to Azure Resource Manager-based REST APIs. |
| 27 | + |
| 28 | +## Create in REST API |
| 29 | + |
| 30 | +For REST API, use the |
| 31 | +[Service Groups - Create or Update]() |
| 32 | +endpoint to create a new service group. In this example, the service group **groupId** is |
| 33 | +_Contoso_. |
| 34 | + |
| 35 | +- REST API URI |
| 36 | + |
| 37 | + ```http |
| 38 | + PUT https://management.azure.com/providers/Microsoft.Management/serviceGroups/Contoso?api-version=2024-02-01-preview |
| 39 | + ``` |
| 40 | + |
| 41 | +- Request Body |
| 42 | + |
| 43 | +The **groupId** is a unique identifier being created. This ID is used by other commands to reference |
| 44 | +this group and it can't be changed later. |
| 45 | + |
| 46 | +If you want the service group to show a different name within the Azure portal, add the |
| 47 | +**properties.displayName** property in the request body. For example, to create a service group |
| 48 | +with the **groupId** of _Contoso_ and the display name of _Contoso Group_, use the following |
| 49 | +endpoint and request body: |
| 50 | + |
| 51 | +```json |
| 52 | +{ |
| 53 | + "properties": { |
| 54 | + "displayName": "_Contoso Group_", |
| 55 | + "parent": { |
| 56 | + "resourceId": "/providers/Microsoft.Management/serviceGroups/[tenantId]" |
| 57 | + } |
| 58 | + } |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | + |
| 63 | +In the preceding examples, the new service group is created under the root service group. To |
| 64 | +specify a different service group as the parent, use the **properties.parent.id** property. |
| 65 | + |
| 66 | +- REST API URI |
| 67 | + |
| 68 | + ```http |
| 69 | + PUT https://management.azure.com/providers/Microsoft.Management/serviceGroups/Contoso?api-version=2024-02-01-preview |
| 70 | + ``` |
| 71 | + |
| 72 | +- Request Body |
| 73 | + |
| 74 | + ```json |
| 75 | + { |
| 76 | + "properties": { |
| 77 | + "displayName": "Contoso Group", |
| 78 | + "parent": { |
| 79 | + "id": "/providers/Microsoft.Management/serviceGroups/HoldingGroup" |
| 80 | + } |
| 81 | + } |
| 82 | + } |
| 83 | + ``` |
| 84 | + |
| 85 | +## Verify your Service Group was created |
| 86 | +Service Groups PUT or create call is an Asynchronous call which means that the response to the initial create call is an HTTP status code 201: Accepted. This response doesn't mean the Service group was successfully created, only that the Azure successfully received the request to create the Service Group. |
| 87 | + |
| 88 | +To check the operation was successful, you should do a GET call on the value returned in the **azure-asyncoperation** header. The URL provides the status of the created operation. |
| 89 | + |
| 90 | +> ![NOTE] |
| 91 | +> To avoid issues within scripts or templates, the automation should poll this provided URL before moving to the next step. If the automation moves to the next step before the operation has responded successful, the next operation will fail as the Service Group has not been created. |
| 92 | +
|
| 93 | +## Clean up resources |
| 94 | + |
| 95 | +To remove the service group created in this document, use the |
| 96 | +[Management Groups - Delete]() endpoint: |
| 97 | + |
| 98 | +- REST API URI |
| 99 | + |
| 100 | + ```http |
| 101 | + DELETE https://management.azure.com/providers/Microsoft.Management/serviceGroups/Contoso?api-version=2024-02-01-preview |
| 102 | + ``` |
| 103 | + |
| 104 | +- No Request Body |
| 105 | + |
| 106 | +## Related content |
| 107 | +* [What are Azure Service Groups?](overview.md) |
| 108 | +* [How to: Manage Service Groups](manaage-service-groups.md) |
| 109 | +* [Connect service group members with REST API](create-service-group-member-rest-api.md) |
0 commit comments