You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type = "/diagnosticSettings@2017-04-01-preview"
parent_id = "/providers/microsoft.intune"
name = "testAPI1"
body = {"properties":{"logs":[{"category":"AuditLogs","categoryGroup":null,"enabled":true,"retentionPolicy":{"days":0,"enabled":false}},{"category":"OperationalLogs","categoryGroup":null,"enabled":false,"retentionPolicy":{"days":0,"enabled":false}},{"category":"DeviceComplianceOrg","categoryGroup":null,"enabled":false,"retentionPolicy":{"days":0,"enabled":false}},{"category":"Devices","categoryGroup":null,"enabled":false,"retentionPolicy":{"days":0,"enabled":false}},{"category":"Windows365AuditLogs","categoryGroup":null,"enabled":false,"retentionPolicy":{"days":0,"enabled":false}}],"metrics":[],"workspaceId":"/subscriptions/MySubscriptionID/resourceGroups/MyResourceName/providers/Microsoft.OperationalInsights/workspaces/myresource-LogAnalytics-TransverseMonitoring","logAnalyticsDestinationType":null}}
}_
Issue:
Return
creating/updating Resource: (ResourceId "/providers/microsoft.intune/providers//diagnosticSettings/testAPI1" / Api Version "2017-04-01-preview"): PUT
│ https://management.azure.com/providers/microsoft.intune/providers/diagnosticSettings/testAPI1
│ --------------------------------------------------------------------------------
│ RESPONSE 404: 404 Not Found
│ ERROR CODE: InvalidResourceNamespace
│ --------------------------------------------------------------------------------
│ {
│ "error": {
│ "code": "InvalidResourceNamespace",
│ "message": "The resource namespace 'diagnosticSettings' is invalid."
│ }
│ }
│ --------------------------------------------------------------------------------
Working case with powershell
#Connect-Azaccount
$tokenInfo = Get-AzAccessToken -ResourceUrl "https://management.azure.com"
$authHeader = @{
Authorization = "{0} {1}" -f $tokenInfo.Type, $tokenInfo.Token
ContentType = "application/json"
}
Description
I am trying to forward Intune logs to Azure Log Analytics Workspace with this terraform provider but cannot get it to work.
Basically:
Issue:
Return
Working case with powershell
#Connect-Azaccount
$tokenInfo = Get-AzAccessToken -ResourceUrl "https://management.azure.com"
$authHeader = @{
Authorization = "{0} {1}" -f $tokenInfo.Type, $tokenInfo.Token
ContentType = "application/json"
}
$subscriptionId = "My-Subscription-ID"
$url = "https://management.azure.com/providers/microsoft.intune/diagnosticSettings/testAPI?api-version=2017-04-01-preview"
$body = '{"properties":{"logs":[{"category":"AuditLogs","categoryGroup":null,"enabled":true,"retentionPolicy":{"days":0,"enabled":false}},{"category":"OperationalLogs","categoryGroup":null,"enabled":false,"retentionPolicy":{"days":0,"enabled":false}},{"category":"DeviceComplianceOrg","categoryGroup":null,"enabled":false,"retentionPolicy":{"days":0,"enabled":false}},{"category":"Devices","categoryGroup":null,"enabled":false,"retentionPolicy":{"days":0,"enabled":false}},{"category":"Windows365AuditLogs","categoryGroup":null,"enabled":false,"retentionPolicy":{"days":0,"enabled":false}}],"metrics":[],"workspaceId":"/subscriptions/My-Subscription-ID9/resourceGroups/myresource/providers/Microsoft.OperationalInsights/workspaces/MyResourceName-LogAnalytics-TransverseMonitoring","logAnalyticsDestinationType":null}}'
$diagParam = @{
URI = $url
Method = "PUT"
Headers = $authHeader
Body = $($body)
}
$diagnostics = Invoke-RestMethod @diagParam -ContentType "application/json"
$diagnostics
Environment/question
Has anyone tried this before ? what am I doing wrong ? can it be done ?
The text was updated successfully, but these errors were encountered: