The Azure Cloud Shell is a browser-based shell for managing your Azure
resources. It's interactive,
authenticated and accessible without you having to install anything on your
local machine. That means you can have a command line like experience,
right from your Azure Portal.
A key to a successful cloud environment is automating the
creation, maintenance, and deployment of your resources.
And to do this at some point, you're going to have to use a shell.
The cloud shell gives you access to this to a command line and you can use bash
or PowerShell to execute your commands. It's a great tool.
It's easy to use and available for anyone to use.
As long as you have an Azure subscription, at no additional costs.
You have two ways of accessing the Cloud Shell.
You can visit the direct Cloud Shell link,
or you can go to your Azure Portal and click on the Cloud Shell icon on the top,
right? For this video, we're going to be using that latter method.
Let's dive in.
Alrighty, everybody, it is demo time.
I am inside of my Azure Portal and I'm going to click on the Cloud Shell icon on
the top left. If this is your first time accessing the cloud shell,
you're going to be asked to select between PowerShell and Bash.
Make sure you select Bash.
And then you're going to be asked to create a storage account,
go ahead and create that. And then you should see a screen,
very similar to mine. Don't worry if you're more of a PowerShell person,
you can always switch between Bash and PowerShell on this top left corner here.
But for this demo, we're going to be using Bash.
The first line we see here is Gwyneth at Azure. This, uh,
value on the left side is the first name of the user that I am logged into.
So in my case, that's Gwyneth and this whole line is telling the cloud shell.
Hey,
this person who has accessed the cloud shell is automatically authenticated.
And that's because we logged in via the Azure Portal.
Now, the first thing we typically do is make sure we are working inside of the
correct subscription. Just like you would in like the UI using the Portal.
Before we do that,
let's actually take a look at all of these subscriptions we have available.
We can access that information by using AZ account list.
Any Azure command that you want to execute inside of the
cloud shell is going to start off with AZ. Next we have account.
And then we have lists. So this command is just saying, Hey, cloud shell,
list all of the information that account has. If we hit enter,
we're going to be returned a list in JSN format.
And this is going to provide every subscription that is available inside of this
account. There's a bunch of details in here,
but what matters for this demo is the value for name.
So I'm going to go ahead and copy that.
Now that we know the name of the subscription, we want to work inside.
How do we tell me cloud shell, Hey,
set this as the subscription I want to work in. I'm glad you asked.
It's actually AZ account count set.
Okay.
And we're going to say dash dash subscription
subscription, and then inside of single quotes,
we're going to provide the name of the subscription and you can paste this in,
but since it's a simple name for me, I'm gonna go ahead and just type it out.
Now the AZ account is the same. So we're not going to go over that again.
Instead of listing here, we're setting,
cause we're applying a change and next we have this dash dash subscription.
Now you've noticed that this looks different than the other ones.
This is because this is an argument or sometimes called an option.
Arguments are used to customize your commands or provide them more details.
In this case, we're saying, Hey, Azure account,
can you set the subscription to the name inside of single quotes.
Right now we're going to hit enter. This time around we didn't get any output.
There was nothing returned to us compared to the first time when we actually got
a list. That's okay. Some commands have output and some just don't.
You may be asking, well,
how do I know if I'm actually in the right subscription?
If I didn't get any output or any success messages or anything like that.
And that is a solid question. We do have a command for that as well.
We can do AZ account shell and we're going to get another list.
But this list is only going to have one entry, many details, but just one entry.
You're going to see very similar to that first list,
except there's only one subscription in here.
And the name of that subscription alongside all the details,
belong to the subscription that your cloud shell is set to work in.
And there we go from here on any commands that we want to run,
we should be ready to do so.
We have access to the cloud shell,
used the bash commands to list the available subscriptions and we set the actual
subscription we want to work in. What a day!
I'll make sure to link some additional resources.
So you can read up on the cloud shell. Alrighty Cloud Gurus,
that's it for this episode of ACG Fundamentals.
Go on and give the cloud shell a test drive.
Let me know how it went in the comments. Keep being awesome,
and I'll see you in the next one.