The scope of the custom recommendation. Valid scopes are: management group (format: 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: 'subscriptions/{subscriptionId}'), or security connector (format: 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'
/**
* Samples for CustomRecommendations Delete.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/
* DeleteByManagementGroupCustomRecommendation_example.json
*/
/**
* Sample code: Delete a custom recommendation over management group scope.
*
* @param manager Entry point to SecurityManager.
*/
public static void deleteACustomRecommendationOverManagementGroupScope(
com.azure.resourcemanager.security.SecurityManager manager) {
manager.customRecommendations().deleteByResourceGroupWithResponse(
"providers/Microsoft.Management/managementGroups/contoso", "ad9a8e26-29d9-4829-bb30-e597a58cdbb8",
com.azure.core.util.Context.NONE);
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.security import SecurityCenter
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-security
# USAGE
python delete_by_management_group_custom_recommendation_example.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 = SecurityCenter(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
client.custom_recommendations.delete(
scope="providers/Microsoft.Management/managementGroups/contoso",
custom_recommendation_name="ad9a8e26-29d9-4829-bb30-e597a58cdbb8",
)
# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/DeleteByManagementGroupCustomRecommendation_example.json
if __name__ == "__main__":
main()
from azure.identity import DefaultAzureCredential
from azure.mgmt.security import SecurityCenter
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-security
# USAGE
python delete_by_security_connector_custom_recommendation_example.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 = SecurityCenter(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
client.custom_recommendations.delete(
scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector",
custom_recommendation_name="ad9a8e26-29d9-4829-bb30-e597a58cdbb8",
)
# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/DeleteBySecurityConnectorCustomRecommendation_example.json
if __name__ == "__main__":
main()
from azure.identity import DefaultAzureCredential
from azure.mgmt.security import SecurityCenter
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-security
# USAGE
python delete_by_subscription_custom_recommendation_example.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 = SecurityCenter(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
client.custom_recommendations.delete(
scope="subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23",
custom_recommendation_name="1f3afdf9-d0c9-4c3d-847f-89da613e70a8",
)
# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/DeleteBySubscriptionCustomRecommendation_example.json
if __name__ == "__main__":
main()