Table of Contents
Background
Six good things to know this week! Some are more helpful than others, but two of these solved my impediments this week!
A bit more technical contents this week as well!
How to open multiple repositories in VS Code with individual source control
I wanted to have multiple repositories open at the same time, without have to open and close them.
I learned that it’s possible to create something called a Workspace, where you can create new folers and point them to a folder that is managed by Git.
Clone Git Repo and add the folder to the workspace by browsing for it.
This really helped me becoming more efficient when working on multiple projects.
Workspaces in Visual Studio Code
How to see assigned Graph permissions
Let’s say that you are working with a Managed Identity and are granting it permissions to Microsoft Graph or another API.
Now imagine that you forget to document the permissions and eventually have to do it again.
How can you find out what permissions the Managed Identity currently has assigned to it?
Easy! By going to the Azure AD and viewing the App registration, you can see a full list of all the permissions granted and how it is granted.
Perfect for when you need to verify a setup during testing or want to double-check that you did the right thing!
It could look something like this!

Also, you can do the same thing with users and groups, instead of looking at app registrations, if you have the need, since they also can have permissions to the API.
Managed Identities for automation accounts.
Are you creating a new Runbook and need specific permissions, for example to Microsoft Graph, to run it?
If you are using an Automation Account that already exists, you should know that they share the same Managed Identity.
This means that all runbooks in that AA will have the same permissions. SometÃme this is something you want, but otherwise you should create a separate AA, just to make sure you are following the principle of least permission!
So to summarize, all Runbooks in an Automation Account uses the same Managed Identity!
Using a system-assigned managed identity for an Azure Automation account | Microsoft Learn
How to test Runbooks using the Test Pane
You mostly know what you are doing, but when creating a new Runbook or updating an existing one, it can be nice to test it before publishing it.
Fortunately, it’s quite easy to do from the Edit pane.
Open your Runbook, click Edit and click the button called Test pane.

In the next view, you can run your new script without publishing it to production.

From this pane, you can see the results live, view the last test output and more!
Sure helps then testing new solutions.
Manage runbooks in Azure Automation | Microsoft Learn
How to add multiple objects to an array
I recently had a challenge where I hade to loop through multiple objects with powershell, where some of the properties were arrays.
I wasn’t sure how to deal with this and make it manageable.
After doing some digging around, I found a way that allowed me to do what I wanted!
In my example, I will use a couple of users.
Start by declaring a new array.
$Objects = @()
Create your first object and add it to the array you just created. This will create an object with my first user, Bob, and add it to the array.
$Object1 = New-Object PSObject -Property @{
Name = "Bob"
Groups = "Hr", "Users"
Department = "HR"
}
$Objects+= $Object1
Now you do it again, but call the user object $Object2
$Object2 = New-Object PSObject -Property @{
Name = "Nick"
Groups = "Finance", "Users"
Department = "Finance"
}
$Objects+= $Object2
Doing this, would mean that we have an Array, consisting of multiple Objects, both in this case are users.

This makes it easy to loop through them and do a for each loop for the Group property. You could for example add them to multiple groups or do something else that requires two attributes.
With this method, you can add how many objects you want and loop through each property at your pleasure.
I had a need to scan through the AD for specific users, and I needed multiple groups for each scenario, and this method allowed me to find exactly what I needed!
How to find the Type of a PowerShell variable
Okay, let’s say that you tried the method above, creating the $Objects array.
But how can you be sure that it is an array? By using teh GetType() method of course!
By this I mean that you can use methods in powershell to check almost every variable you have, to figure out what type it is.
It is very simple, and it looks like this:

As you can see the image, the BaseType property of the Object we created earlier is definitely an Array!
Object.GetType Method (System) | Microsoft Learn
Summary
This week we learned new things about the following topics!
- How to use multiple Git repositories in VSCode at the same time.
- How to see the assigned API permissions to a service principal.
- How Managed Identities for Automation Accounts and Runbooks work.
- How to use the Test pane for Runbooks.
- How to create an Array in PowerShell with multiple objects in it.
- How to easily find the Type of the variable or object you are working with.
Resources
Workspaces in Visual Studio Code
Using a system-assigned managed identity for an Azure Automation account | Microsoft Learn