Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save FH-Inway/2513c1627b2b3beb89321b0c6243c598 to your computer and use it in GitHub Desktop.

Select an option

Save FH-Inway/2513c1627b2b3beb89321b0c6243c598 to your computer and use it in GitHub Desktop.
d365fo.tools Az.Storage Test in Codespace
# Replace the following three variables with values for your own azure storage
$azureStorageAccountId = "miscfiles"
$sas = "sv2018-03-28&siunlisted&src&sigAUOpdsfpoWE976ASDhfjkasdf(5678sdfhk"
$container = "backupfiles"
$repositoryModulePath = "/workspaces/d365fo.tools/d365fo.tools"
$fileName = "Test.txt"
# load module
Set-PSFConfig d365fo.tools.Import.IndividualFiles -Value $true
Set-PSFConfig d365fo.tools.Import.DoDotSource -Value $true
Import-Module -Name $repositoryModulePath -Force -Passthru -Verbose
# run tests
New-Item /workspaces/temp/$fileName
Set-Content /workspaces/temp/$fileName "d365fo.tools Az.Storage test"
Invoke-D365AzureStorageUpload -Verbose -AccountId $azureStorageAccountId -SAS $sas -Container $container -Filepath "/workspaces/temp/$fileName" -ContentType "text/plain" -Force -DeleteOnUpload
$file = Get-D365AzureStorageFile -Verbose -AccountId $azureStorageAccountId -SAS $sas -Container $container -Name $fileName
$file
Invoke-D365AzureStorageDownload -Verbose -AccountId $azureStorageAccountId -SAS $sas -Container $container -Name $fileName -Path "/workspaces/temp"
Remove-Item /workspaces/temp/$fileName -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment