get azure subscriptions‘ all stroages,containers and blobs by PowerShell
2017-11-17 10:48
316 查看
导到excel里
# Add your Azure account to the local PowerShell environment. Add-AzureRmAccount -Environment AzureChinaCloud $x=1 $excel = New-Object -ComObject Excel.Application $excel.Visible = $true $workbook = $excel.Workbooks.add() $sheet = $workbook.worksheets.Item(1) $SubscriptionNames = Get-AzureRMSubscription foreach ($sub in $SubscriptionNames) { $subname=$sub.name $sheet.cells.item($x, 1) = "SubscriptionName" $x++ $sheet.cells.item($x, 1) = $subname $x++ Select-AzureRMSubscription -SubscriptionName $subname $StorageAccountNames=Get-AzureRmStorageAccount foreach($str in $StorageAccountNames) { $strname=$str.StorageAccountName $strrg=$str.ResourceGroupName $sheet.cells.item($x, 2) = "ResourceGroup" $x++ $sheet.cells.item($x, 2) = $strrg $x++ $sheet.cells.item($x, 3) = "storage account name" $x++ $sheet.cells.item($x, 3) = $strname $x++ $StorageAccountKey = Get-AzurermStorageaccountKey -ResourceGroupName $strrg -Name $strname $Ctx = New-AzureStorageContext $strname -StorageAccountKey $StorageAccountKey.GetValue(0).value $containers=Get-AzureStorageContainer -Context $Ctx $sheet.cells.item($x, 4) = "container" $x++ foreach($con in $containers) { $conname=$con.Name $sheet.cells.item($x, 4) = $conname $x++ $blobs=Get-AzureStorageBlob -Context $ctx -Container $conname $sheet.cells.item($x, 5) = "blob" $x++ foreach($blob in $blobs) { $blob2=$blob $sheet.cells.item($x, 5) = $blob2.Name $sheet.cells.item($x,2) = $blob2.BlobType $x++ } } } }
相关文章推荐
- Azure:Manage anonymous read access to containers and blobs
- 获取表单对象,得三种方法getElementById(), getElementsByName(), and getElementsByTagName() 和用法
- When the RTP port is set to 8005, why is 8006 used by RTP and 8007 for RTCP for all communications ?
- javascript 如何正确使用getElementById,getElementsByName(), and getElementsByTagName()
- 获取表单对象,getElementById(), getElementsByName(), and getElementsByTagName() 和用法
- Understand Machine Learning Algorithms By Implementing Them From Scratch (and tactics to get around
- Force stop and then start a full crawl on all content sources in a SharePoint 2010 farm using PowerShell(转)
- T-sql get alll columns name and column type from table
- Solve all your Linear Algebra Headaches and Get to Understand How it Works with Unity.
- INFO: HTTP GET and HTTP POST Are Disabled by Default
- document,document.all,getElementById,getElementsByName,getElementsByTagName
- querySelectorAll与getElementsBy对比有什么不同
- .python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filena
- Adblock Plus and all related projects are governed by a module ownership system.
- document.all & document.getElementsByName?
- javascript 如何正确使用getElementById,getElementsByName(), and getElementsByTagName()
- register component and get object --- illustrated by MSSG
- document,document.all,getElementById,getElementsByName,getElementsByTagName
- document.all与getElementById、getElementsByName、getElementsByTagName用法区别-getElementById
- 获取表单对象,得三种方法getElementById(), getElementsByName(), and getElementsByTagName() 和用法