Azure / Azure/azure-powershell

Import-AzAutomationRunbook does not close the input file handle

Open
#15,603 4 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad Automation Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

## Description
When Import-AzAutomationRunbook is called the command does not close the file handle therefore it's not possible to use the same file in subsequent operations. Looks like the problem is at AutomationPSClient.ImportRunbook() line ~624

## Steps to reproduce
Try to publish the same ps1 file to multiple automation accounts in a loop.

## Environment data

```
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

## Module versions

```powershell

```

## Debug output

```

```

## Error output

```

```

Contributor guide

Open the contributing guide

Research direction

Start in AutomationPSClient.ImportRunbook() near line 624 and reproduce the issue by publishing the same .ps1 file to multiple automation accounts in a loop. Trace the input file handle's lifecycle and verify that the file can be reused after each Import-AzAutomationRunbook call.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.