Alerts - Update Subscription Level State To Dismiss
Reference
Service:
Defender for Cloud
API Version:
2022-01-01
Update the alert's state
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss?api-version=2022-01-01
URI Parameters
Name
In
Required
Type
Description
alertName
path
True
string
Name of the alert object
ascLocation
path
True
string
The location where ASC stores the data of the subscription. can be retrieved from Get locations
POST https://management.azure.com/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westeurope/alerts/2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a/dismiss?api-version=2022-01-01
/**
* Samples for Alerts UpdateSubscriptionLevelStateToDismiss.
*/
public final class Main {
/*
* x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/
* UpdateAlertSubscriptionLocation_dismiss_example.json
*/
/**
* Sample code: Update security alert state on a subscription from a security data location.
*
* @param manager Entry point to SecurityManager.
*/
public static void updateSecurityAlertStateOnASubscriptionFromASecurityDataLocation(
com.azure.resourcemanager.security.SecurityManager manager) {
manager.alerts().updateSubscriptionLevelStateToDismissWithResponse("westeurope",
"2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", com.azure.core.util.Context.NONE);
}
}
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.SecurityCenter;
// Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertSubscriptionLocation_dismiss_example.json
// this example is just showing the usage of "Alerts_UpdateSubscriptionLevelStateToDismiss" 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 SubscriptionSecurityAlertResource created on azure
// for more information of creating SubscriptionSecurityAlertResource, please refer to the document of SubscriptionSecurityAlertResource
string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23";
AzureLocation ascLocation = new AzureLocation("westeurope");
string alertName = "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a";
ResourceIdentifier subscriptionSecurityAlertResourceId = SubscriptionSecurityAlertResource.CreateResourceIdentifier(subscriptionId, ascLocation, alertName);
SubscriptionSecurityAlertResource subscriptionSecurityAlert = client.GetSubscriptionSecurityAlertResource(subscriptionSecurityAlertResourceId);
// invoke the operation
await subscriptionSecurityAlert.DismissAsync();
Console.WriteLine($"Succeeded");
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).