Skip to content

Instantly share code, notes, and snippets.

@krnese
Created May 24, 2020 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krnese/e00bc368c4d7cc75cab093880b278410 to your computer and use it in GitHub Desktop.
Save krnese/e00bc368c4d7cc75cab093880b278410 to your computer and use it in GitHub Desktop.
Enable diagnostics of AAD to Log Analytics
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logAnalyticsResourceId": {
"type": "string",
"metadata": {
"description": "Provide the resourceId to your Log Analytics workspace that will receive the AAD auding/sign-in logs."
}
}
},
"resources": [
{
"type": "microsoft.aadiam/diagnosticSettings",
"apiVersion": "2017-04-01",
"name": "setByARM",
"properties": {
"workspaceId": "[parameters('logAnalyticsResourceId')]",
"logAnalyticsDestinationType": null,
"logs": [
{
"category": "AuditLogs",
"enabled": true,
"retentionPolicy": {
"days": 0,
"enabled": false
}
},
{
"category": "SignInLogs",
"enabled": true,
"retentionPolicy": {
"days": 0,
"enabled": false
}
}
],
"metrics": []
}
}
],
"outputs": {}
}
@debaxtermsft
Copy link

If you want to be able to turn on all of the other categories for Diagnostic Logging (more than signin/audit logs)
You can hit the below repository json file

https://raw.githubusercontent.com/debaxtermsft/debaxtermsft/main/diaglogs2.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment