You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure SQL表有记录时向用户组发邮件通知:Runbook执行报错求助

Troubleshooting the "CommandNotFound Exception" in Azure Automation Runbook

Hey there, let's break down this CommandNotFound Exception you're hitting with your Azure Automation Runbook. This error typically means the system can't locate the specific command or Runbook you're trying to execute, so let's walk through the most likely fixes tailored to your scenario:

1. Double-check the Runbook Name and Path

The error mentions SqlAutomation/RB_Record_AzureScheduler—this looks like a Runbook with a folder path. Make sure:

  • The Runbook exists in your target Automation Account, with exact matching name and folder structure (Azure Automation is case-sensitive, so even a typo like rb_record_azurescheduler instead of RB_Record_AzureScheduler will cause this issue).
  • If you're calling this Runbook from another script (using Start-AzAutomationRunbook), verify the -Name and -RunbookPath parameters are correctly set to match the Runbook's location.

2. Ensure the Runbook is Published

Draft Runbooks can't be executed or called—they need to be published first. Navigate to your Automation Account, find RB_Record_AzureScheduler, and check if there's a Publish button at the top. If yes, click it to publish the Runbook, then retry execution.

3. Verify Dependent Modules Are Available

If your Runbook relies on SQL-related cmdlets or custom modules:

  • Go to your Automation Account > Modules, and confirm modules like Az.Sql or SqlServer are imported and up-to-date. Outdated or missing modules can lead to cmdlet not found errors.
  • If you're using a custom module or script, ensure it's uploaded to the Automation Account's Assets > Modules/Scripts section and properly configured.

4. Validate Execution Permissions

While this error is mostly about existence, permission issues can sometimes manifest similarly:

  • Check that the Runbook's execution identity (either Run As Account or Managed Identity) has Reader access to the Automation Account (to locate the Runbook) and appropriate permissions on your Azure SQL Database (to query table records).
  • Confirm the Run As Account hasn't expired or had its permissions revoked in Azure AD.

5. Debug with the Test Panel

Use the Automation Account's built-in test panel to run the Runbook step-by-step. This will help you pinpoint exactly which line of code triggers the error—whether it's a nested Runbook call gone wrong, or a missing cmdlet in your script.

内容的提问来源于stack exchange,提问作者Raji

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 06:38:15