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

Can you get a Storage Account URI via Powershell?

我是 Azure 的新手,正在使用 powershell 来自动化一些事情。我希望使用需要 URI 的 New-AzureRmSqlDatabaseExport cmdlet。我想知道如何获取存储帐户 URI?我可以使用 Powershell 命令来获取它吗?

我尝试了 运行 Get-AzureRmStorageAccount cmdlet,但它没有 return URI。任何帮助,将不胜感激!

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 创建一个。

尝试如下操作:

$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 is of kind PSStorageAccount 的输出,因此您可以查看其他可用的属性。