【发布时间】:2018-08-15 21:23:41
【问题描述】:
我正在准备一个脚本,该脚本启用诊断日志将它们发送到存储帐户。
Get-AzureRmResource | foreach {
#For now adding all registered resources to Diagnostics Logs. Should narrow to specific resource types?
#Categories "Execution", "Request" only, the "AllMetrics" category intended to log all categories fail. Can add specific categories to each resource type.
Write-Output "Adding resource $_.ResourceId to the storage"
Set-AzureRmDiagnosticSetting -ResourceId $_.ResourceId -StorageAccountId $storageid -Enabled $true -RetentionEnabled $true -RetentionInDays 90 -Categories “Execution”,“Request”
}
此 PowerShell 命令匹配以启用对订阅中创建的资源的诊断日志。
如何在 Azure Active Directory 中启用诊断日志?它们包括审核和登录日志?
有人可以请教吗?
非常感谢!
塞尔吉奥
更新:
我需要使用 PowerShell 自动执行以下操作:
1. 转到 Azure 门户
2. 在左侧边栏选项卡上,选择 Azure Active Directory
3. 选择审核日志或登录日志 4. 在顶部菜单中,选择导出数据设置
5.单击添加诊断设置
6. 选中存档到存储帐户并设置保留天数。
视频中描述的过程:
Video discussing Azure AD reports shows how to enable the Logs, I am required to automate enabling the logs, not getting the report
【问题讨论】:
标签: azure powershell azure-active-directory azure-diagnostics