Enter-AzShell
cmdlet¶The Enter-AzShell
cmdlet is a new addition to the Microsoft.DotNet.Interactive.PowerShell
module.
Running it will authenticate you to Azure and establish a PowerShell cloud shell session for you.
After that, all subsequent code submitted from the cells are executed in that cloud shell session.
When you are done with the cloud shell, just type and run exit
from a cell to end the session, and after that, all subsequent code submitted from the cells will again be executed using the local PowerShell kernel.
Let's get started with some examples!
First, let's list the available cmdlets from the Microsoft.DotNet.Interactive.PowerShell
.
Get-Command -Module Microsoft.DotNet.Interactive.PowerShell
There you go! Now run Enter-AzShell
.
Enter-AzShell
Now we are connected to the PowerShell Azure cloud shell session, and the code submitted from cells will run in the cloud shell session.
Let's run some commands.
cd Azure:\
dir
Get-AzLog -max 3
hostname
When you are done with using the cloud shell session, run exit
to end the session.
exit
Now, code submitted from cells will again be executed by the local PowerShell kernel.
hostname