【发布时间】:2026-02-10 17:25:01
【问题描述】:
所以我知道 Azure Cloud Shell 背后有一个存储帐户。如何找出它是哪个存储帐户以及最重要的是我的 Cloud Shell 存储帐户属于哪个资源组?
【问题讨论】:
标签: azure azure-storage-account azure-cloud-shell
所以我知道 Azure Cloud Shell 背后有一个存储帐户。如何找出它是哪个存储帐户以及最重要的是我的 Cloud Shell 存储帐户属于哪个资源组?
【问题讨论】:
标签: azure azure-storage-account azure-cloud-shell
【讨论】:
基于上述共享需求,我们创建了以下 PowerShell 脚本,它将拉取云 shell 存储帐户及其各自的资源组。
我们已经在本地环境中测试了以下脚本,它运行良好。
这是 PowerShell 脚本:
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
}
}
注意:
所有云 Shell 存储帐户的名称都以“cs”开头,并且相应的资源组将以“cloud-shell-storage”开头,因此我们使用了-like 运算符和wildcards 来拉取存储列表帐户。
这是供参考的示例输出:
【讨论】: