您可以通过Powershell获得存储帐户URI吗?

问题描述 投票:0回答:2

我对Azure非常陌生,并且正在使用powershell来自动化一些东西。我希望使用New-AzureRmSqlDatabaseExport cmdlet,它需要URI。我想知道如何获取存储帐户URI?我可以使用Powershell命令来抓取它吗?

我尝试运行Get-AzureRmStorageAccount cmdlet,但是它不返回URI。任何帮助,将不胜感激!

azure powershell uri
2个回答
0
投票

New-AzureRmSqlDatabaseExport不仅需要为您的存储帐户提供uri,而且还需要您的存储帐户中的Blob容器。

uri可从AzureStorageContainer对象的属性中获取:

Get-AzStorageAccount -StorageAccountName <name of your storage account> -ResourceGroupName <name of rg that holds your storage account> | 
  Get-AzStorageContainer | 
  Select-Object Name,@{n='Uri'; e={$_.CloudBlobContainer.Uri}}

如果存储帐户中还没有Blob容器,则可以使用New-AzStorageContainer创建一个。


0
投票

尝试以下操作:

$Account = Get-AzureRmStorageAccount -Name <account-name> -ResourceGroupName <resource-group-name>
$Account.PrimaryEndpoints #Gives you all endpoints
$Account.PrimaryEndpints.Blob #Gives you blob endpoint

Get-AzureRmStorageAccount的输出属于Get-AzureRmStorageAccount类型,因此您可以看到其他可用的属性。

© www.soinside.com 2019 - 2024. All rights reserved.