Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

5
Outside of AzCopy has anyone written any scripts to upload files an azure file container
Post Flair (click to view more posts with a particular flair)
Post Body

Curious before I look into it. If not I’ll post what I end up making.

Here is what I have so far:

$localFile = "C:\Users\Bob\Pictures\"

$StorageAccountName = "{accountName}"
$StorageAccountKey = "{AccountKey}"

$azure_StorageContextSplat = @{
StorageAccountName = $StorageAccountName
StorageAccountKey = $StorageAccountKey
}

$ctx = New-AzureStorageContext @azure_StorageContextSplat

$ContainerName = "photos"

$BlobName = "11111.jpg"

$localFile = $localFile   $BlobName

Set-AzureStorageBlobContent -File $localFile -Container $ContainerName `
    -Blob $BlobName -Context $ctx

Still working over this issue:

Set-AzureStorageBlobContent : Method not found: 'System.Net.HttpWebRequest Microsoft.WindowsAzure.Storage.RequestEventArgs.get_Request()'.
At line:40 char:1
  Set-AzureStorageBlobContent -File $localFile -Container $ContainerNam ...
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CategoryInfo          : CloseError: (:) [Set-AzureStorageBlobContent], StorageException
  FullyQualifiedErrorId : StorageException,Microsoft.WindowsAzure.Commands.Storage.Blob.SetAzureBlobContentCommand

The above doesn’t work but I installed the Module "Az" from MS and it worked as intended. I welcome any input as to why the above did not work.

This works if you need it:

Install-Module -Name Az -AllowClobber -Force

$StorageAccountName = "{MyAccountName}"
$StorageAccountKey = "{MyAccountKey}"

$azure_StorageContextSplat = @{
StorageAccountName = $StorageAccountName
StorageAccountKey = $StorageAccountKey
}

$storageContext = New-AzStorageContext @azure_StorageContextSplat

$azure_FileToUploadSplat = @{
Context = $storageContext
File = "C:\users\Bob\pictures\11111.jpg"
Container = "photos"
Force = $true
}

Set-AzStorageBlobContent @azure_FileToUploadSplat

Author
Account Strength
100%
Account Age
13 years
Verified Email
Yes
Verified Flair
No
Total Karma
26,663
Link Karma
8,214
Comment Karma
18,430
Profile updated: 4 days ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago