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?
One way to find the URL of the blob is by using the Azure portal by going to Home > Storage Account > Container > Blob > Properties. However, probably the easiest way is to find the blob in the Storage Explorer, right-click, then select 'Copy URL'. This will copy the resource URL directly to the clipboard.
Is there any way to check the status of a blob upload? If no exception throws from your code, it means the blob has been uploaded successfully. Otherwise, a exception will be thrown. You can also confirm it using any web debugging proxy tool(ex.
In order to download an Azure BLOB Storage item by its URL, you need to instantiate a CloudBlockBlob yourself using the item's URL: var blob = new CloudBlockBlob(new Uri(pdfFileUrl), cloudStorageAccount. Credentials); This blob can then be downloaded with the code you originally posted.
Retrieve blob information using the Get-AzureStorageBlob cmdlet and select the AbsoluteUri
:
(Get-AzureStorageBlob -blob 'StarterSite.zip' -Container 'clouddata ').ICloudBlob.uri.AbsoluteUri
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With