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
CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Enter-AzShell 0.1.0 Microsoft.DotNet.Int… Cmdlet New-PlotlyChart 0.1.0 Microsoft.DotNet.Int… Cmdlet Out-Display 0.1.0 Microsoft.DotNet.Int…
There you go! Now run Enter-AzShell
.
Enter-AzShell
Authenticating with Azure... To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code BZU7QNJAY to authenticate. Requesting Cloud Shell...Succeeded. Connecting terminal... MOTD: Modules installed with 'Install-Module' are persisted across sessions VERBOSE: Authenticating to Azure ... VERBOSE: Building your Azure drive ... Welcome to Azure Cloud Shell! Submitted code will run in the Azure Cloud Shell, type 'exit' to quit.
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
cd Azure:\ dir Directory: Azure: Mode SubscriptionName SubscriptionId TenantId ---- ---------------- -------------- -------- + Visual Studio Ultimate with MSDN 99d1d4aa-4408-4117-b1fd-28a6a1bb10b0 453fb556-678d-4480-ad85…
Get-AzLog -max 3
Get-AzLog -max 3 WARNING: 6:21:06 AM - *** The namespace for all the model classes will change from Microsoft.Azure.Management.Monitor.Management.Models to Microsoft.Azure.Management.Monitor.Models in future releases. WARNING: 6:21:06 AM - *** The namespace for output classes will be uniform for all classes in future releases to make it independent of modifications in the model classes. WARNING: [Get-AzLog] Parameter deprecation: The DetailedOutput parameter will be deprecated in a future breaking change release. Authorization : Scope : /subscriptions/99d1d4aa-4408-4117-b1fd-28a6a1bb10b0/resourceGrou ps/cloud-shell-storage-southcentralus/providers/Microsoft.Storage/storageAcc ounts/cs799d1d4aa4408x4117xb1f Action : Microsoft.Storage/storageAccounts/listKeys/action Role : Condition : Claims : aud : https://management.core.windows.net/ iss : https://sts.windows.net/453fb556-678d-4480-ad85-0fb14b2ed2a4/ iat : 1584511264 nbf : 1584511264 exp : 1584515164 http://schemas.microsoft.com/claims/authnclassreference: 1 aio : AUQAu/8OAAAAQLHHrgEYzU4CaDx5YQ8R8iM+XITd3eUDEiX/lCz8FMTkgzs DQf07c1a64hzcMfUV6AbHDi39vp1fII8rO8x9Ng== altsecid : 1:live.com:0006BFFD9555D217 http://schemas.microsoft.com/claims/authnmethodsreferences: pwd appid : 245e1dee-74ef-4257-a8c8-8208296e1dfd appidacr : 0 http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress: rockyterminator@hotmail.com http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname: Wang http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname: Dongbo groups : b873ef20-4cb2-4ce6-93d9-6c3b44766ebb http://schemas.microsoft.com/identity/claims/identityprovider: live.com ipaddr : 50.46.216.48 name : Dongbo Wang http://schemas.microsoft.com/identity/claims/objectidentifier: d8e84d9f-bdcb-4c74-aadf-b5601dad7649 puid : 10037FFE8779A7C7 http://schemas.microsoft.com/identity/claims/scope: user_impersonation http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier: Y7EN1vBLk9nJZtlbpW2z9au8CV_OozYHzKKYS29guUY http://schemas.microsoft.com/identity/claims/tenantid: 453fb556-678d-4480-ad85-0fb14b2ed2a4 http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name: live.com#rockyterminator@hotmail.com uti : elkRbf4SsE6tUER3Rg5RAA ver : 1.0 wids : 62e90394-69f5-4237-9190-012177145e10 HttpRequest : ClientId : b2920582-7aea-4ebc-b50e-e3677cfd5ea4 Method : POST Url : ClientIpAddress : 104.210.220.216 Properties : statusCode : OK serviceRequestId: 5ab1fb4e-dab4-41a8-9062-6d667bb364fc Level : Informational SubmissionTimestamp : 3/18/2020 6:07:41 AM EventTimestamp : 3/18/2020 6:06:08 AM Caller : rockyterminator@hotmail.com Description : Id : /subscriptions/99d1d4aa-4408-4117-b1fd-28a6a1bb10b0/resourceGroups/cloud-she ll-storage-southcentralus/providers/Microsoft.Storage/storageAccounts/cs799d 1d4aa4408x4117xb1f/events/67c2e90c-a3cd-4912-b67c-ad0d2770b833/ticks/6372010 83682737399 EventDataId : 67c2e90c-a3cd-4912-b67c-ad0d2770b833 CorrelationId : bd2d95fa-4947-4d46-b87c-fb47a39995a1 EventName : Microsoft.Azure.Management.Monitor.Models.LocalizableString Category : Microsoft.Azure.Management.Monitor.Models.LocalizableString ResourceGroupName : cloud-shell-storage-southcentralus ResourceProviderName : Microsoft.Azure.Management.Monitor.Models.LocalizableString ResourceId : /subscriptions/99d1d4aa-4408-4117-b1fd-28a6a1bb10b0/resourceGroups/cloud-she ll-storage-southcentralus/providers/Microsoft.Storage/storageAccounts/cs799d 1d4aa4408x4117xb1f ResourceType : OperationId : bd2d95fa-4947-4d46-b87c-fb47a39995a1 OperationName : Microsoft.Azure.Management.Monitor.Models.LocalizableString Status : Microsoft.Azure.Management.Monitor.Models.LocalizableString SubStatus : Microsoft.Azure.Management.Monitor.Models.LocalizableString SubscriptionId : 99d1d4aa-4408-4117-b1fd-28a6a1bb10b0 TenantId : Authorization : Scope : /subscriptions/99d1d4aa-4408-4117-b1fd-28a6a1bb10b0/resourceGrou ps/cloud-shell-storage-southcentralus/providers/Microsoft.Storage/storageAcc ounts/cs799d1d4aa4408x4117xb1f Action : Microsoft.Storage/storageAccounts/listKeys/action Role : Condition : Claims : aud : https://management.core.windows.net/ iss : https://sts.windows.net/453fb556-678d-4480-ad85-0fb14b2ed2a4/ iat : 1584511264 nbf : 1584511264 exp : 1584515164 http://schemas.microsoft.com/claims/authnclassreference: 1 aio : AUQAu/8OAAAAQLHHrgEYzU4CaDx5YQ8R8iM+XITd3eUDEiX/lCz8FMTkgzs DQf07c1a64hzcMfUV6AbHDi39vp1fII8rO8x9Ng== altsecid : 1:live.com:0006BFFD9555D217 http://schemas.microsoft.com/claims/authnmethodsreferences: pwd appid : 245e1dee-74ef-4257-a8c8-8208296e1dfd appidacr : 0 http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress: rockyterminator@hotmail.com http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname: Wang http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname: Dongbo groups : b873ef20-4cb2-4ce6-93d9-6c3b44766ebb http://schemas.microsoft.com/identity/claims/identityprovider: live.com ipaddr : 50.46.216.48 name : Dongbo Wang http://schemas.microsoft.com/identity/claims/objectidentifier: d8e84d9f-bdcb-4c74-aadf-b5601dad7649 puid : 10037FFE8779A7C7 http://schemas.microsoft.com/identity/claims/scope: user_impersonation http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier: Y7EN1vBLk9nJZtlbpW2z9au8CV_OozYHzKKYS29guUY http://schemas.microsoft.com/identity/claims/tenantid: 453fb556-678d-4480-ad85-0fb14b2ed2a4 http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name: live.com#rockyterminator@hotmail.com uti : elkRbf4SsE6tUER3Rg5RAA ver : 1.0 wids : 62e90394-69f5-4237-9190-012177145e10 HttpRequest : ClientId : b2920582-7aea-4ebc-b50e-e3677cfd5ea4 Method : POST Url : ClientIpAddress : 104.210.220.216 Properties : Level : Informational SubmissionTimestamp : 3/18/2020 6:07:41 AM EventTimestamp : 3/18/2020 6:06:08 AM Caller : rockyterminator@hotmail.com Description : Id : /subscriptions/99d1d4aa-4408-4117-b1fd-28a6a1bb10b0/resourceGroups/cloud-she ll-storage-southcentralus/providers/Microsoft.Storage/storageAccounts/cs799d 1d4aa4408x4117xb1f/events/30e4aad3-190f-419b-a9fc-957e3f6a419b/ticks/6372010 83682306219 EventDataId : 30e4aad3-190f-419b-a9fc-957e3f6a419b CorrelationId : bd2d95fa-4947-4d46-b87c-fb47a39995a1 EventName : Microsoft.Azure.Management.Monitor.Models.LocalizableString Category : Microsoft.Azure.Management.Monitor.Models.LocalizableString ResourceGroupName : cloud-shell-storage-southcentralus ResourceProviderName : Microsoft.Azure.Management.Monitor.Models.LocalizableString ResourceId : /subscriptions/99d1d4aa-4408-4117-b1fd-28a6a1bb10b0/resourceGroups/cloud-she ll-storage-southcentralus/providers/Microsoft.Storage/storageAccounts/cs799d 1d4aa4408x4117xb1f ResourceType : OperationId : bd2d95fa-4947-4d46-b87c-fb47a39995a1 OperationName : Microsoft.Azure.Management.Monitor.Models.LocalizableString Status : Microsoft.Azure.Management.Monitor.Models.LocalizableString SubStatus : Microsoft.Azure.Management.Monitor.Models.LocalizableString SubscriptionId : 99d1d4aa-4408-4117-b1fd-28a6a1bb10b0 TenantId : Authorization : Scope : /subscriptions/99d1d4aa-4408-4117-b1fd-28a6a1bb10b0/resourceGrou ps/cloud-shell-storage-southcentralus/providers/Microsoft.Storage/storageAcc ounts/cs799d1d4aa4408x4117xb1f Action : Microsoft.Storage/storageAccounts/listKeys/action Role : Condition : Claims : aud : https://management.core.windows.net/ iss : https://sts.windows.net/453fb556-678d-4480-ad85-0fb14b2ed2a4/ iat : 1584508258 nbf : 1584508258 exp : 1584512158 http://schemas.microsoft.com/claims/authnclassreference: 1 aio : AUQAu/8OAAAAmFG9k2+EKbEtTwkdNxZkvnvdRsamY2gJ2Rj8TR/mOFF1b4x TaCOFAwITpfvEaM1Ca0ZVlH+w5vRdPXQiS5BTcg== altsecid : 1:live.com:0006BFFD9555D217 http://schemas.microsoft.com/claims/authnmethodsreferences: pwd appid : 245e1dee-74ef-4257-a8c8-8208296e1dfd appidacr : 0 http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress: rockyterminator@hotmail.com http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname: Wang http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname: Dongbo groups : b873ef20-4cb2-4ce6-93d9-6c3b44766ebb http://schemas.microsoft.com/identity/claims/identityprovider: live.com ipaddr : 50.46.216.48 name : Dongbo Wang http://schemas.microsoft.com/identity/claims/objectidentifier: d8e84d9f-bdcb-4c74-aadf-b5601dad7649 puid : 10037FFE8779A7C7 http://schemas.microsoft.com/identity/claims/scope: user_impersonation http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier: Y7EN1vBLk9nJZtlbpW2z9au8CV_OozYHzKKYS29guUY http://schemas.microsoft.com/identity/claims/tenantid: 453fb556-678d-4480-ad85-0fb14b2ed2a4 http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name: live.com#rockyterminator@hotmail.com uti : Y0CcrLeo4Eawa1d3T2NYAA ver : 1.0 wids : 62e90394-69f5-4237-9190-012177145e10 HttpRequest : ClientId : 83e4087b-8b96-4bae-98f6-04eb92f5e75b Method : POST Url : ClientIpAddress : 104.210.220.216 Properties : statusCode : OK serviceRequestId: 75a6f4e5-8092-4dd2-8760-5674fc9dfe05 Level : Informational SubmissionTimestamp : 3/18/2020 5:17:38 AM EventTimestamp : 3/18/2020 5:16:02 AM Caller : rockyterminator@hotmail.com Description : Id : /subscriptions/99d1d4aa-4408-4117-b1fd-28a6a1bb10b0/resourceGroups/cloud-she ll-storage-southcentralus/providers/Microsoft.Storage/storageAccounts/cs799d 1d4aa4408x4117xb1f/events/3c427e2a-cc8f-4552-a7fa-dec7c28ab01f/ticks/6372010 53623045240 EventDataId : 3c427e2a-cc8f-4552-a7fa-dec7c28ab01f CorrelationId : 652ebf84-1b93-46cb-a298-3218e4e59493 EventName : Microsoft.Azure.Management.Monitor.Models.LocalizableString Category : Microsoft.Azure.Management.Monitor.Models.LocalizableString ResourceGroupName : cloud-shell-storage-southcentralus ResourceProviderName : Microsoft.Azure.Management.Monitor.Models.LocalizableString ResourceId : /subscriptions/99d1d4aa-4408-4117-b1fd-28a6a1bb10b0/resourceGroups/cloud-she ll-storage-southcentralus/providers/Microsoft.Storage/storageAccounts/cs799d 1d4aa4408x4117xb1f ResourceType : OperationId : 652ebf84-1b93-46cb-a298-3218e4e59493 OperationName : Microsoft.Azure.Management.Monitor.Models.LocalizableString Status : Microsoft.Azure.Management.Monitor.Models.LocalizableString SubStatus : Microsoft.Azure.Management.Monitor.Models.LocalizableString SubscriptionId : 99d1d4aa-4408-4117-b1fd-28a6a1bb10b0 TenantId :
hostname
hostname cc-b3aa132e-9d5f76c9-t47t6
When you are done with using the cloud shell session, run exit
to end the session.
exit
Azure Cloud Shell session ended. Submitted code will run in the local PowerShell sub kernel.
Now, code submitted from cells will again be executed by the local PowerShell kernel.
hostname
my-Air.home