'Set-AzDiagnosticSetting' failing

FATOBA, KIMBERLY 45 Reputation points

Whilst trying to configure Diag settings for Storage account, i have encountered the below :

The term 'Set-AzDiagnosticSetting' 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.

Set-AzDiagnosticSetting -ResourceId xxxx -Enabled $true -StorageAccountId xxx -Name xxxx -Category xxx -RetentionEnabled $true -RetentionInDays xxxx

Please not i have tried - Debug with no luck.

SA is Standard LRS and no HNS enabled

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,939 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,836 questions
{count} votes

2 answers

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 18,211 Reputation points

    @FATOBA, KIMBERLY Welcome to Microsoft Q & A Community Forum. Kindly note that Set-AzDiagnosticSetting has been replaced with New-AzDiagnosticSetting in Az.Monitor 4.2.0. Check Package Details section of this document for more information.

    For sample reference of New-AzDiagnosticSetting, refer this document.

    If this answers your query, do click "Accept as Answer" and click "Yes" for the same, which might be beneficial to other community members reading this thread. If you have further questions, kindly revert with further information so that we can assist you accordingly.

  2. FATOBA, KIMBERLY 45 Reputation points

    @SwathiDhanwada-MSFT: the initial query was the below :

    Set-AzDiagnosticSetting -ResourceId $databricks.ResourceId -Enabled $true -StorageAccountId $storageAccount.ResourceId -Name $dataBricksDiagnosticName -Category $dataBricksDiagnosticCategories -RetentionEnabled $true -RetentionInDays $diagnosticRetentionInDays

    New query introduced:

    New-AzDiagnosticSetting -Name $DataBricksDiagnosticName -ResourceId $databricks.ResourceId -StorageAccountId $storageaccount.id   -metric $mettric -log $log -workspaceid $workspace.workspaceResourceId

    The process that resolved this was to first update the modules on the agent pool and then introduce the new set of pwsh command with a few code adjustments.