Reputation: 475
I am very new to Azure and am working with powershell to automate some stuff. I am hoping to use the New-AzureRmSqlDatabaseExport
cmdlet, which requires the URI. I was wondering how I can get a storage account URI? Can I use a Powershell command to grab it?
I tried running the Get-AzureRmStorageAccount
cmdlet, but it does not return the URI. Any help would be appreciated!
Upvotes: 0
Views: 1943
Reputation: 136136
Try something like the following:
$Account = Get-AzureRmStorageAccount -Name <account-name> -ResourceGroupName <resource-group-name>
$Account.PrimaryEndpoints #Gives you all endpoints
$Account.PrimaryEndpints.Blob #Gives you blob endpoint
The output of Get-AzureRmStorageAccount
is of kind PSStorageAccount
so you can see other properties available to you.
Upvotes: 2
Reputation: 3596
The New-AzureRmSqlDatabaseExport
requires not only an uri to your storage account, but to a blob container on your storage account.
The uri can be taken from the properties of the AzureStorageContainer
object:
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}}
If there is no blob container in your storage account yet, you can create one using New-AzStorageContainer
.
Upvotes: 1