Löscht eine Virtual Instance for SAP-Lösungsressource und ihre untergeordneten Ressourcen, d. h. die zugeordnete Central Services-Instanz, Anwendungsserverinstanzen und Datenbankinstanz.
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsClient(
credential=DefaultAzureCredential(),
subscription_id="6d875e77-e412-4d7d-9af4-8895278b4443",
)
response = client.sap_virtual_instances.begin_delete(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Delete.json
if __name__ == "__main__":
main()
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads;
using Azure.ResourceManager.Workloads.Models;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/preview/2021-12-01-preview/examples/sapvirtualinstances/SAPVirtualInstances_Delete.json
// this example is just showing the usage of "SAPVirtualInstances_Delete" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SapVirtualInstanceResource created on azure
// for more information of creating SapVirtualInstanceResource, please refer to the document of SapVirtualInstanceResource
string subscriptionId = "6d875e77-e412-4d7d-9af4-8895278b4443";
string resourceGroupName = "test-rg";
string sapVirtualInstanceName = "X00";
ResourceIdentifier sapVirtualInstanceResourceId = SapVirtualInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, sapVirtualInstanceName);
SapVirtualInstanceResource sapVirtualInstance = client.GetSapVirtualInstanceResource(sapVirtualInstanceResourceId);
// invoke the operation
ArmOperation<OperationStatusResult> lro = await sapVirtualInstance.DeleteAsync(WaitUntil.Completed);
OperationStatusResult result = lro.Value;
Console.WriteLine($"Succeeded: {result}");