Skip to content

Commit 964c830

Browse files
Get all accounts at subscription level
1 parent eb4ff91 commit 964c830

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/ResourceManager/Automation/Commands.Automation/Model/AutomationAccount.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,18 @@ public class AutomationAccount
3636
/// </param>
3737
public AutomationAccount(string resourceGroupName, AutomationManagement.Models.AutomationAccount automationAccount)
3838
{
39-
Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
4039
Requires.Argument("AutomationAccount", automationAccount).NotNull();
4140

42-
this.ResourceGroupName = resourceGroupName;
41+
42+
if (!string.IsNullOrEmpty(resourceGroupName))
43+
{
44+
this.ResourceGroupName = resourceGroupName;
45+
}
46+
else
47+
{
48+
this.ResourceGroupName = automationAccount.Id.Substring(1).Split(Convert.ToChar("/"))[3];
49+
}
50+
4351
this.AutomationAccountName = automationAccount.Name;
4452
this.Location = automationAccount.Location;
4553

0 commit comments

Comments
 (0)