I'm adding Diagnostic Settings via (Az) PowerShell to a LogicApp using the below powershell command, however, nothing is created in the diagnostic setting of the resource.
$LogicApp = "/subscriptions/dc4e35b0-3a98-41a6-86a0-e83de3d06b2e/resourceGroups/Lieblik/providers/Microsoft.Logic/workflows/logic-lieblik-sitepoolingscheduler"
$Workspace = Get-AzOperationalInsightsWorkspace -Name "BO-Crayon-LAW" -ResourceGroupName "commonservices"
New-AzDiagnosticSetting -ResourceId $LogicApp -WorkspaceId $Workspace.ResourceId -Name "DiagMonitor"
I waited hours to check if it was due to some delay, but no luck!.

Below is the
scriptwhich worked for me:$RithResourceId is the resource id of the resource where you want to create diagnostic setting.
Output: