Skip to content

Commit 41a982c

Browse files
GijsreynVeryEarly
andauthored
(FIX) Fix runbook type on PowerShell72 (#28599)
Co-authored-by: Yabo Hu <[email protected]>
1 parent fefef36 commit 41a982c

File tree

8 files changed

+22
-18
lines changed

8 files changed

+22
-18
lines changed

src/Automation/Automation/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed runbook_type: `PowerShell72` [#24779][#23967]
2122

2223
## Version 1.11.1
2324
* Fixed Bug: Start-AzAutomationRunbook throws object reference error when the automation account is not available in the subscription

src/Automation/Automation/Cmdlet/ImportAzureAutomationRunbook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class ImportAzureAutomationRunbook : AzureAutomationBaseCmdlet
6868
Constants.RunbookType.Graph,
6969
Constants.RunbookType.Python2,
7070
Constants.RunbookType.Python3,
71-
Constants.RunbookType.Powershell72,
71+
Constants.RunbookType.PowerShell72,
7272
IgnoreCase = true)]
7373
[ValidateNotNullOrEmpty]
7474
public string Type { get; set; }

src/Automation/Automation/Cmdlet/NewAzureAutomationRunbook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class NewAzureAutomationRunbook : AzureAutomationBaseCmdlet
5959
Constants.RunbookType.Graph,
6060
Constants.RunbookType.Python2,
6161
Constants.RunbookType.Python3,
62-
Constants.RunbookType.Powershell72,
62+
Constants.RunbookType.PowerShell72,
6363
IgnoreCase = true)]
6464
[ValidateNotNullOrEmpty]
6565
public string Type { get; set; }

src/Automation/Automation/Common/AutomationPSClient.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public void DeleteAutomationAccount(string resourceGroupName, string automationA
330330
#region Module
331331

332332
public Module CreateModule(string resourceGroupName, string automationAccountName, Uri contentLink,
333-
string moduleName,bool isPowershell72Module = false)
333+
string moduleName,bool IsPowerShell72Module = false)
334334
{
335335
ModuleCreateOrUpdateParameters moduleCreateOrUpdateParameters = new AutomationManagement.Models.ModuleCreateOrUpdateParameters()
336336
{
@@ -342,7 +342,7 @@ public Module CreateModule(string resourceGroupName, string automationAccountNam
342342
Version = null
343343
},
344344
};
345-
if (isPowershell72Module)
345+
if (IsPowerShell72Module)
346346
{
347347
this.automationManagementClient.PowerShell72Module.CreateOrUpdate(resourceGroupName,
348348
automationAccountName,
@@ -358,15 +358,15 @@ public Module CreateModule(string resourceGroupName, string automationAccountNam
358358
moduleCreateOrUpdateParameters
359359
);
360360
}
361-
return this.GetModule(resourceGroupName, automationAccountName, moduleName, isPowershell72Module);
361+
return this.GetModule(resourceGroupName, automationAccountName, moduleName, IsPowerShell72Module);
362362
}
363363

364-
public Module GetModule(string resourceGroupName, string automationAccountName, string name, bool isPowershell72Module = false)
364+
public Module GetModule(string resourceGroupName, string automationAccountName, string name, bool IsPowerShell72Module = false)
365365
{
366366
try
367367
{
368368
AutomationManagement.Models.Module module =null;
369-
if (isPowershell72Module)
369+
if (IsPowerShell72Module)
370370
{
371371
module = this.automationManagementClient.PowerShell72Module.Get(resourceGroupName, automationAccountName, name);
372372
}
@@ -390,13 +390,13 @@ public Module GetModule(string resourceGroupName, string automationAccountName,
390390
}
391391

392392
public IEnumerable<Module> ListModules(string resourceGroupName, string automationAccountName,
393-
ref string nextLink, bool isPowershell72Module = false)
393+
ref string nextLink, bool IsPowerShell72Module = false)
394394
{
395395
Rest.Azure.IPage<AutomationManagement.Models.Module> response;
396396

397397
if (string.IsNullOrEmpty(nextLink))
398398
{
399-
if (isPowershell72Module)
399+
if (IsPowerShell72Module)
400400
{
401401
response = this.automationManagementClient.PowerShell72Module.ListByAutomationAccount(resourceGroupName, automationAccountName);
402402
}
@@ -407,7 +407,7 @@ public IEnumerable<Module> ListModules(string resourceGroupName, string automati
407407
}
408408
else
409409
{
410-
if (isPowershell72Module)
410+
if (IsPowerShell72Module)
411411
{
412412
response = this.automationManagementClient.PowerShell72Module.ListByAutomationAccountNext(nextLink);
413413
}
@@ -422,7 +422,7 @@ public IEnumerable<Module> ListModules(string resourceGroupName, string automati
422422
}
423423

424424
public Module UpdateModule(string resourceGroupName, string automationAccountName, string name,
425-
Uri contentLinkUri, string contentLinkVersion, bool isPowershell72Module = false)
425+
Uri contentLinkUri, string contentLinkVersion, bool IsPowerShell72Module = false)
426426
{
427427
try
428428
{
@@ -441,7 +441,7 @@ public Module UpdateModule(string resourceGroupName, string automationAccountNam
441441
};
442442
if (contentLinkUri != null)
443443
{
444-
if (isPowershell72Module)
444+
if (IsPowerShell72Module)
445445
{
446446
this.automationManagementClient.PowerShell72Module.CreateOrUpdate(resourceGroupName,
447447
automationAccountName,
@@ -460,7 +460,7 @@ public Module UpdateModule(string resourceGroupName, string automationAccountNam
460460
}
461461

462462
}
463-
return this.GetModule(resourceGroupName, automationAccountName, name, isPowershell72Module);
463+
return this.GetModule(resourceGroupName, automationAccountName, name, IsPowerShell72Module);
464464
}
465465
catch (ErrorResponseException cloudException)
466466
{
@@ -475,11 +475,11 @@ public Module UpdateModule(string resourceGroupName, string automationAccountNam
475475
}
476476
}
477477

478-
public void DeleteModule(string resourceGroupName, string automationAccountName, string name, bool isPowershell72Module = false)
478+
public void DeleteModule(string resourceGroupName, string automationAccountName, string name, bool IsPowerShell72Module = false)
479479
{
480480
try
481481
{
482-
if (isPowershell72Module)
482+
if (IsPowerShell72Module)
483483
{
484484
this.automationManagementClient.PowerShell72Module.Delete(resourceGroupName, automationAccountName, name);
485485
}

src/Automation/Automation/Common/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static class RunbookType
9292

9393
public const string Python3 = "Python3";
9494

95-
public const string Powershell72 = "Powershell72";
95+
public const string PowerShell72 = "PowerShell72";
9696
}
9797

9898
public static class RuntimeVersion

src/Automation/Automation/help/Import-AzAutomationRunbook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ It is equivalent to GraphicalPowerShellWorkflow.
235235
Type: System.String
236236
Parameter Sets: (All)
237237
Aliases:
238-
Accepted values: PowerShell, GraphicalPowerShell, PowerShellWorkflow, GraphicalPowerShellWorkflow, Graph, Python2, Python3, Powershell72
238+
Accepted values: PowerShell, GraphicalPowerShell, PowerShellWorkflow, GraphicalPowerShellWorkflow, Graph, Python2, Python3, PowerShell72
239239

240240
Required: True
241241
Position: Named

src/Automation/Automation/help/New-AzAutomationRunbook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ It is equivalent to GraphicalPowerShellWorkflow.
182182
Type: System.String
183183
Parameter Sets: (All)
184184
Aliases:
185-
Accepted values: PowerShell, GraphicalPowerShell, PowerShellWorkflow, GraphicalPowerShellWorkflow, Graph, Python2, Python3, Powershell72
185+
Accepted values: PowerShell, GraphicalPowerShell, PowerShellWorkflow, GraphicalPowerShellWorkflow, Graph, Python2, Python3, PowerShell72
186186

187187
Required: True
188188
Position: Named
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"Module","ClassName","Target","Severity","ProblemId","Description","Remediation"
2+
"Az.Automation","Microsoft.Azure.Commands.Automation.Cmdlet.ImportAzureAutomationRunbook","Import-AzAutomationRunbook","0","2040","The validation set for parameter 'Type' for cmdlet 'Import-AzAutomationRunbook' no longer contains the value 'Powershell72'.","Add 'Powershell72' back to the validation set for 'Type'."
3+
"Az.Automation","Microsoft.Azure.Commands.Automation.Cmdlet.NewAzureAutomationRunbook","New-AzAutomationRunbook","0","2040","The validation set for parameter 'Type' for cmdlet 'New-AzAutomationRunbook' no longer contains the value 'Powershell72'.","Add 'Powershell72' back to the validation set for 'Type'."

0 commit comments

Comments
 (0)