Share via


DeviceManagementClient.DeleteGroupAsync(String, RequestContext) Method

Definition

Deletes a device group. This group is automatically created when a Device Update-enabled device is connected to the hub and reports its properties. Groups, subgroups, and deployments are not automatically cleaned up but are retained for history purposes. Users can call this method to delete a group if they do not need to retain any of the history of the group and no longer need it. If a device is ever connected again for this group after the group was deleted it will be automatically re-created but there will be no history.

public virtual System.Threading.Tasks.Task<Azure.Response> DeleteGroupAsync (string groupId, Azure.RequestContext context = default);
abstract member DeleteGroupAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.DeleteGroupAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function DeleteGroupAsync (groupId As String, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

groupId
String

Group identifier.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

groupId is null.

groupId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call DeleteGroupAsync with required parameters.

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceManagementClient(endpoint, "<instanceId>", credential);

Response response = await client.DeleteGroupAsync("<groupId>");
Console.WriteLine(response.Status);

Remarks

Schema for Response Error:

{
              error: {
                code: string,
                message: string,
                target: string,
                details: [Error],
                innererror: {
                  code: string,
                  message: string,
                  errorDetail: string,
                  innerError: InnerError
                },
                occurredDateTime: string (ISO 8601 Format)
              }
            }

Applies to