Did you know that the Azure Portal has a feature to connect using PowerShell in the cloud? With this there’s no need to connect using local PowerShell; simply connect, authenticate and start running commands on your Azure site. In this post, I’ll demo how to use this nice feature.
- When logged into the Azure Portal, click on the Cloud Shell button in the top ribbon.
- This will open a box where you can log in with Bash or PowerShell; I’ll use PowerShell for this example.
- Right away, you’ll see that it’s attempting to log us in, and I’ll copy a command from that PowerShell window that will try to connect to our tenant.
- First, we need to verify authentication. To do this, I’ll open a new window and enter the code we’ll see in the PowerShell connection window in the portal when it prompts us to log in and then we’ll be authenticated.
- Once I’m logged in, I see I’m connected and that I have a Tenant ID and a Subscription, so the Azure portal is now available for connection through PowerShell.
- We’re not connected to the laptop here. Typically, we’d log into our PowerShell locally, using the Windows PowerShell or the Windows PowerShell ISE. ISE allows you to save PS1 files as the file extension for the PowerShell and you can execute those another time, as well as parameterize them.
- When I’m connected to my Azure PowerShell, I’ll run a few commands to test it out. This should tell me my objects that I have access to.
- I’ll then copy/paste to list my Azure groups on my dashboard, and I see 3 groups; my RG Demo, Group and the third one is hosting this PowerShell session.
- Next, from my PowerShell notebook, I’ll copy my RG Demo resource group and paste it into my PowerShell window. This will bring up my information regarding that group.
- I can also pinpoint a specific name of an object, in this case the Azure Data Factory PWC. I can go ahead and paste that into PowerShell, and it will give me some good information on that.
There’s a lot you can do with the PowerShell. For example, maybe I have a self-hosted integration runtime running my Azure Data Factory and I’d like to pause that or restart it; I can do that with the Azure PowerShell.
So, this is a nice feature that’s hosted on the web as part of the Azure platform. It exposes a lot of functionality for administration purposes for monitoring and getting to the root access to much of that information.
We all know life can get hectic. Here at Pragmatic Works, we're no different. But one of our goals is to learn something new about Azure every day, as things are constantly changing and being updated. Many people are still learning all the amazing things they can do within the Azure cloud and we want to help. Our posts in our Azure Every Day series are a great way to learn more about Azure each week.
If you’d like to learn more or have questions on using the PowerShell within Azure, click the link below or contact us. We’re here to help you with anything cloud or Azure related, whether you’re just starting out in the cloud or are just stuck with a question on any product or service. Our experts are ready to help you take your business from good to great.