I want to enable Defender for Cloud for a subset of resources in an Azure subscription. I already enabled it for some VMs as mentioned in this blog
I need to enable this for some of the app services in this subscription. this is what I tried so far,
$url = "https://management.azure.com/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/providers/Microsoft.Web/sites/$appServiceName/providers/Microsoft.Security/pricings/AppServices?api-version=2024-01-01"
$accessToken = (Get-AzAccessToken).Token
$headers = @{
"Authorization" = "Bearer $accessToken"
"Content-Type" = "application/json"
}
$body = @{
location = $location
properties = @{
pricingTier = "Standard"
}
} | ConvertTo-Json
Invoke-RestMethod -Method Put -Uri $url -Body $body -Headers $headers
This is the error I get:
Invoke-RestMethod :
{“error”:{“code”:”InvalidUrlConfiguration”,”message”:”The plan name
‘AppServices’ is not supported for resource level pricing.”}}
When I run the following command I get a null value output:
https://management.azure.com/{scopeId}/providers/Microsoft.Security/pricings?api-version=2024-01-01
output:
{
"value": []
}
Is there a way (GUI, REST API or CLI) I can enable defender for cloud for App services without enabling it at the subscription level?