PowerShell执行Get-AzureRmDataFactoryV2ActivityRun遇NotFound错误求助
Get-AzureRmDataFactoryV2ActivityRun Got it, let’s tackle that frustrating NotFound error you’re hitting with the Get-AzureRmDataFactoryV2ActivityRun command in PowerShell. I’ve seen this pop up plenty of times, and it almost always comes down to a small parameter mismatch or context oversight. Here’s how to work through it:
1. Nail down your parameter values (no typos allowed!)
First, let’s rule out the simplest issues—typos or missing parameters are the #1 culprit here:
- Data Factory Name: Double-check that
"maxscadfdev"is 100% correct. Even a single extra space or wrong case (while Azure is mostly case-insensitive, why risk it?) can throw this error. - Resource Group: Did you include the
-ResourceGroupNameparameter? If not, PowerShell might be looking in a default resource group that doesn’t have your Data Factory. Always specify this explicitly to avoid confusion. - Pipeline Run ID & Time Window: This command needs a valid
-PipelineRunIdand a time range (-RunStartedAfter/-RunStartedBefore) that covers when the activity actually ran. If the run ID is wrong, or your time window is too narrow (e.g., you set it to 1 hour but the run was 2 hours ago), it’ll come back empty with a NotFound error. Grab the correct run ID from your Data Factory’s Monitor tab in the Azure Portal, and widen the time range a bit to be safe.
2. Make sure you’re in the right Azure context
Ever logged into your personal Azure subscription by mistake when you meant to use your work one? Yeah, same here. Run these quick commands to confirm:
# Check which subscription/tenant you’re currently connected to Get-AzureRmContext # If it’s wrong, switch to the correct subscription Set-AzureRmContext -SubscriptionId "your-subscription-id"
3. Verify the activity actually ran
Head over to the Azure Portal, navigate to your Data Factory, and go to the Monitor tab. Check if the pipeline run you’re targeting actually has an activity run associated with it. If the pipeline failed before it got to the activity, or the activity never triggered at all, the command won’t find anything to return—hence the NotFound error.
4. Update your Azure PowerShell module
Older versions of the AzureRm.DataFactoryV2 module can have bugs that cause this exact issue. Update to the latest version with this command, then close and reopen your PowerShell session to make sure the new module loads properly:
Update-Module -Name AzureRm.DataFactoryV2 -Force
内容的提问来源于stack exchange,提问作者Praveen

