Hi @risolis , I managed to connectstring using the storage account key. But not sure if this is correct as i have another error. As shown below.
PS E:\>
$FilePath = "E:\Dodz.txt"
$AzureFile01 = "autododz-fs"
$AzRepPathINVENT = "DodzLogs\INVENT"
$ConnectionString = Get-Content $FilePath | ConvertTo-SecureString
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($ConnectionString)
$ConString = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$AzCont = New-AzStorageContext -ConnectionString $ConString
PS E:\> $AzCont
StorageAccountName : ABCDEFG01
BlobEndPoint : https://afsautomations.blob.core.windows.net/
TableEndPoint : https://afsautomations.table.core.windows.net/
QueueEndPoint : https://afsautomations.queue.core.windows.net/
FileEndPoint : https://afsautomations.file.core.windows.net/
Context : Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext
Name :
StorageAccount : DefaultEndpointsProtocol=https;AccountName=afsautomationssa;AccountKey=[key hidden]
TableStorageAccount : DefaultEndpointsProtocol=https;AccountName=afsautomationssa;AccountKey=[key hidden]
Track2OauthToken :
EndPointSuffix : core.windows.net/
ConnectionString : DefaultEndpointsProtocol=https;AccountName=ABCDEFG01;AccountKey=adfadfasdgasgasgadgafgafgafgafgafgafgafgafgafsgafsgasfgafsgafe==
ExtendedProperties : {}
PS E:\>
$Entires = Get-AzStorageFile -ShareName $AzureFile01 -Path $AzRepPathINVENT -Context $AzCont | Get-AzStorageFile
foreach ($entry in $Entires.ShareFileClient) {
Get-AzStorageFileContent -Context $AzCont -ShareName $AzureFile01 -path $entry.path -Destination ('\SERVER01\rawdata\' + $entry.name) -Force
}
I got this ERROR below:
Get-AzStorageFile : An error occurred while sending the request.
At line:2 char:12
$Entires = Get-AzStorageFile -ShareName $AzureFile01 -Path $AzRepPathIN ... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : CloseError: (:) [Get-AzStorageFile], StorageException
FullyQualifiedErrorId : StorageException,Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageFile
PS E:\>