Reputation: 3281
How can i get url of the blob i just uploaded using powershell.My code currently is
$storagekey=Get-AzureStorageKey -StorageAccountName appstorageacc
$ctx=New-AzureStorageContext -StorageAccountName
appstorageacc - StorageAccountKey $storagekey.Primary
Set-AzureStorageBlobContent -File C:\Package\StarterSite.zip
-Container clouddata -Context $ctx -Force
Blob is uploaded successfully, but how can i get it's url out?
Upvotes: 6
Views: 8980
Reputation: 1115
Set-AzureStorageBlobContent
$result = Set-AzureStorageBlobContent -File C:\Package\StarterSite.zip
$blobUri = $result.ICloudBlob.Uri.AbsoluteUri
It's not necessary to call Get-AzureStorageBlob
after calling Set-AzureStorageBlobContent
.
Set-AzureStorageBlobContent
returns the same object type that Get-AzureStorageBlob
returns.
The output type is AzureStorageBlob
for both Get-AzureStorageBlob
and Set-AzureStorageBlobContent
AzureStorageBlob
has a ICloudBlob property
AzureStorageBlob.ICloudBlob
getter returns a CloudBlob
which has the Uri
property
Upvotes: 4
Reputation: 59001
Retrieve blob information using the Get-AzureStorageBlob cmdlet and select the AbsoluteUri
:
(Get-AzureStorageBlob -blob 'StarterSite.zip' -Container 'clouddata ').ICloudBlob.uri.AbsoluteUri
Upvotes: 9