1

So I know that there is a storage account behind Azure Cloud Shell. How can I find out which storage account it is and most important which resource group is my Cloud Shell storage account belongs to?

Steve
  • 175
  • 1
  • 3
  • 14

2 Answers2

1

When you use basic settings and select only a subscription, Cloud Shell creates three resources on your behalf in the supported region that's nearest to you:

  • Resource group: cloud-shell-storage-[region]
  • Storage account: cs[uniqueGuid]
  • File share: cs-[user]-[domain]-com-[uniqueGuid]

Storage accounts that you create in Cloud Shell are tagged with ms-resource-usage:azure-cloud-shell.

enter image description here

Ken W - Zero Networks
  • 3,533
  • 1
  • 13
  • 18
  • maybe I am in a big company and many of my colleagues use cloud shell too. How can I find out which uniqueGuid is for myself? – Steve Dec 12 '21 at 05:53
  • Then create a file in your instance of cloud shell then you can search the file share to find the storage account associated. – Ken W - Zero Networks Dec 12 '21 at 20:05
0

Based on the above shared Requirement, we have created the below PowerShell script which will pull the cloud shell storage accounts & their respective resource groups.

We have tested the below script in our local environment which is working fine.

Here is the PowerShell Script :

Connect-AzAccount

$strglist=Get-AzStorageAccount ##pulling the storageaccounts in that particular subscription that you have connected to.

foreach( $item in $strglist){

    if( ($item.StorageAccountName -like 'cs*') -and  ($item.ResourceGroupName -like 'cloud-shell-storage*'))
    {
        Write-Host $item.StorageAccountName,$item.ResourceGroupName
    }
}

Note :

All the cloud Shell storage accounts will have name start with 'cs' & respective resource groups will be with 'cloud-shell-storage' so we have used the -like operator & wildcards to pull the list of storage accounts.

Here is the sample output for reference:

enter image description here

VenkateshDodda
  • 4,723
  • 1
  • 3
  • 12