This command no longer exists on Az.Monitor You'll need to change your command to use the updated commands, currently these are listed: https://learn.microsoft.com/en-gb/powershell/module/az.monitor/new-azscheduledqueryrule?view=azps-11.3.0
Failed to create rule source with exception: The term 'New-AzScheduledQueryRuleSource' is not recognized as the name of a cmdlet, function, script file, or operable program.
I am creating Log analystics workspace, resource group, Azure arc, Data Collection rules and creating alerts.
I have installed latest version of Az modules on my PC, I am successfully able to create Workspace, resource group , On-board Azure ARC on windows machine and Data collection rules but I am unable to create Alerts. I have investigated and found that when Az.Monitor with version other than 1.4.1 installed on machine then the alerts are not creating giving error : Failed to create rule source with exception: The term 'New-AzScheduledQueryRuleSource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
After that I uninstalled Az.Monitor version 4.2.1 and install the version 1.4.1 then I am able to create the Alerts but unable to create Data collection rules. can you please help me out that which version of Az.Monitor allow both the Data collection rules and alert creation.
Giving below error while creating Alert:
Alert query: Event | where EventLog == "Security" and Source == "Microsoft-Windows-Eventlog" and EventID == "1102"
Failed to create rule source with exception: The term 'New-AzScheduledQueryRuleSource' is not recognized as the name of
a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException