Exclui um grupo de recursos.
Quando você exclui um grupo de recursos, todos os seus recursos também são excluídos. A exclusão de um grupo de recursos exclui todas as implantações de modelo e as operações armazenadas no momento.
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}?api-version=2021-04-01
Com parâmetros opcionais:
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}?forceDeletionTypes={forceDeletionTypes}&api-version=2021-04-01
Parâmetros de URI
Nome |
Em |
Obrigatório |
Tipo |
Description |
resourceGroupName
|
path |
True
|
string
|
O nome do grupo de recursos a ser excluído. O nome diferencia maiúsculas de minúsculas.
Padrão Regex: ^[-\w\._\(\)]+$
|
subscriptionId
|
path |
True
|
string
|
A ID da assinatura do Microsoft Azure.
|
api-version
|
query |
True
|
string
|
A versão da API a ser usada para esta operação.
|
forceDeletionTypes
|
query |
|
string
|
Os tipos de recursos que você deseja forçar a exclusão. Atualmente, há suporte apenas para o seguinte: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets
|
Respostas
Nome |
Tipo |
Description |
200 OK
|
|
OK
|
202 Accepted
|
|
Aceito
|
Other Status Codes
|
CloudError
|
Resposta de erro que descreve por que a operação falhou.
|
Segurança
azure_auth
Fluxo do OAuth2 do Azure Active Directory
Tipo:
oauth2
Flow:
implicit
URL de Autorização:
https://login.microsoftonline.com/common/oauth2/authorize
Escopos
Nome |
Description |
user_impersonation
|
representar sua conta de usuário
|
Exemplos
Force delete all the Virtual Machines and Virtual Machine Scale Sets in a resource group
Solicitação de exemplo
DELETE https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group?forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets&api-version=2021-04-01
package armresources_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ForceDeleteVMsAndVMSSInResourceGroup.json
func ExampleResourceGroupsClient_BeginDelete_forceDeleteAllTheVirtualMachinesAndVirtualMachineScaleSetsInAResourceGroup() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armresources.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewResourceGroupsClient().BeginDelete(ctx, "my-resource-group", &armresources.ResourceGroupsClientBeginDeleteOptions{ForceDeletionTypes: to.Ptr("Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets")})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ResourceManagementClient } = require("@azure/arm-resources");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations.
*
* @summary When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ForceDeleteVMsAndVMSSInResourceGroup.json
*/
async function forceDeleteAllTheVirtualMachinesAndVirtualMachineScaleSetsInAResourceGroup() {
const subscriptionId =
process.env["RESOURCES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["RESOURCES_RESOURCE_GROUP"] || "my-resource-group";
const forceDeletionTypes =
"Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets";
const options = { forceDeletionTypes };
const credential = new DefaultAzureCredential();
const client = new ResourceManagementClient(credential, subscriptionId);
const result = await client.resourceGroups.beginDeleteAndWait(resourceGroupName, options);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Force delete all the Virtual Machines in a resource group
Solicitação de exemplo
DELETE https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group?forceDeletionTypes=Microsoft.Compute/virtualMachines&api-version=2021-04-01
package armresources_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4fd842fb73656039ec94ce367bcedee25a57bd18/specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ForceDeleteVMsInResourceGroup.json
func ExampleResourceGroupsClient_BeginDelete_forceDeleteAllTheVirtualMachinesInAResourceGroup() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armresources.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewResourceGroupsClient().BeginDelete(ctx, "my-resource-group", &armresources.ResourceGroupsClientBeginDeleteOptions{ForceDeletionTypes: to.Ptr("Microsoft.Compute/virtualMachines")})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ResourceManagementClient } = require("@azure/arm-resources");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations.
*
* @summary When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations.
* x-ms-original-file: specification/resources/resource-manager/Microsoft.Resources/stable/2021-04-01/examples/ForceDeleteVMsInResourceGroup.json
*/
async function forceDeleteAllTheVirtualMachinesInAResourceGroup() {
const subscriptionId =
process.env["RESOURCES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["RESOURCES_RESOURCE_GROUP"] || "my-resource-group";
const forceDeletionTypes = "Microsoft.Compute/virtualMachines";
const options = { forceDeletionTypes };
const credential = new DefaultAzureCredential();
const client = new ResourceManagementClient(credential, subscriptionId);
const result = await client.resourceGroups.beginDeleteAndWait(resourceGroupName, options);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Definições
Nome |
Description |
CloudError
|
Uma resposta de erro para uma solicitação de gerenciamento de recursos.
|
ErrorAdditionalInfo
|
As informações adicionais do erro de gerenciamento de recursos.
|
ErrorResponse
|
Resposta de erro
|
CloudError
Uma resposta de erro para uma solicitação de gerenciamento de recursos.
Nome |
Tipo |
Description |
error
|
ErrorResponse
|
Resposta de erro
Resposta de erro comum para todas as APIs do Azure Resource Manager para retornar detalhes de erro de operações com falha. (Isso também segue o formato de resposta de erro OData.)
|
ErrorAdditionalInfo
As informações adicionais do erro de gerenciamento de recursos.
Nome |
Tipo |
Description |
info
|
object
|
As informações adicionais.
|
type
|
string
|
O tipo de informação adicional.
|
ErrorResponse
Resposta de erro
Nome |
Tipo |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
As informações adicionais do erro.
|
code
|
string
|
O código de erro.
|
details
|
ErrorResponse[]
|
Os detalhes do erro.
|
message
|
string
|
A mensagem de erro.
|
target
|
string
|
O destino do erro.
|