Share via


DeploymentEnvironmentsClient.DeleteEnvironmentAsync Method

Definition

[Protocol Method] Deletes an environment and all its associated resources

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Operation> DeleteEnvironmentAsync (Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.RequestContext context = default);
abstract member DeleteEnvironmentAsync : Azure.WaitUntil * string * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation>
override this.DeleteEnvironmentAsync : Azure.WaitUntil * string * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation>
Public Overridable Function DeleteEnvironmentAsync (waitUntil As WaitUntil, projectName As String, userId As String, environmentName As String, Optional context As RequestContext = Nothing) As Task(Of Operation)

Parameters

waitUntil
WaitUntil

Completed if the method should wait to return until the long-running operation has completed on the service; Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

projectName
String

The DevCenter Project upon which to execute operations.

userId
String

The AAD object id of the user. If value is 'me', the identity is taken from the authentication context.

environmentName
String

The name of the environment.

context
RequestContext

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

Returns

The Operation representing an asynchronous operation on the service.

Exceptions

projectName, userId or environmentName is null.

projectName, userId or environmentName 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 DeleteEnvironmentAsync.

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

Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "<projectName>", "<userId>", "<environmentName>");

This sample shows how to call DeleteEnvironmentAsync with all parameters.

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

Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "<projectName>", "<userId>", "<environmentName>");

Applies to