Open ChristopheLux opened 1 month ago
Ran into this as well today, I'm pretty sure because it is still using the 2022-06-01
as seen in the trace, and needs to be bumped to the 2023-03-11
api version
https://learn.microsoft.com/en-us/rest/api/monitor/data-collection-rules/create?view=rest-monitor-2023-03-11&tabs=HTTP
Is there any way we can force the API version except going again to Invoke-RestMethod...
@ChristopheLux I made a custom one that uses the newer API version and I still didn't see the endpoint getting populated, so I'm not sure what's going on, I was going to open a ticket and report back.
EDIT: https://gist.github.com/JustinGrote/22c4963f7eb5af08399c26cbf60bc3ae
OK, I think I figured it out.
As of the API spec, there is an ingestion endpoint example where you have to specify the kind as "Direct", note there is a typo, there's an extraneous space in this.
Even though the specs for the Kind parameter say only Windows
and Linux
are supported values.
I updated my script to specify the kind as Direct, and now I got ingestionEndpoints populated.
"endpoints": {
"logsIngestion": "https://xxxx-westus3.logs.z1.ingest.monitor.azure.com",
"metricsIngestion": "https://xxx-westus3.metrics.z1.ingest.monitor.azure.com"
},
With some more experimentation in regards to Kind
, by supplying invalid data to the API, I get back an error that says these are the actual valid values:
Direct,Linux,Windows,WorkspaceTransforms,AgentDirectToStore,AgentSettings,PlatformTelemetry
These appear to be undocumented with a quick google search other than Linux and Windows, these do come back via the 2022 API,
and a test of the 2022 API with Direct does populate the endpoints it seems (there's a significant delay, it's not immediate, some sort of provisioning delay) EDIT: Later testing shows this is not the case
and the endpoints can ONLY be seen with the 2023 API.
Very nice job...I wasn't able to work on this today
@JustinGrote in the documentation for the PowerShell there is https://learn.microsoft.com/en-us/powershell/module/az.monitor/new-azdatacollectionrule?view=azps-12.1.0 the -Kind. Stupid me
@JustinGrote in the documentation for the PowerShell there is https://learn.microsoft.com/en-us/powershell/module/az.monitor/new-azdatacollectionrule?view=azps-12.1.0 the -Kind. Stupid me
yeah but in my initial testing it doesn't seem to populate endpoints unless the API version is 2023 for the PUT, I'm testing that now.
OK based on this testing with my custom cmdlet:
New-JAzDataCollectionRule @testDcrParams -Name 'TestRule2023Direct' -ApiVersion '2023-03-11'
New-JAzDataCollectionRule @testDcrParams -Name 'TestRule2022Direct' -ApiVersion '2022-06-01'
New-JAzDataCollectionRule @testDcrParams -Name 'TestRule2022DirectReplace' -ApiVersion '2022-06-01'
New-JAzDataCollectionRule @testDcrParams -Name 'TestRule2022DirectReplace' -ApiVersion '2023-03-11' #Overwrites previous
#Additional custom attempt of 2023 API but with Kind not specified at all.
Pretty annoying the DCR docs don't mention that Kind: Direct is required
So currently getting DCR endpoints populated is not possible until the API rev gets bumped on this command, you have to use my custom workaround script. I'll updated it and relink https://github.com/Azure/azure-powershell/issues/25727#issuecomment-2265860351
@isra-fel the DataCollectionRule.Autorest needs a bump to 2023-03-11 to resolve this issue.
Great findings 👍 Will plan and prioritize this
Description
Hello Contrary to ARM deployment the DCR logs and metrics endpoints are not generated when created a new DRC with PowerShell
Issue script & Debug output
Environment data
Module versions
Error output
No response