Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions d365fo.tools/functions/get-d365azurestoragefile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function Get-D365AzureStorageFile {

Invoke-TimeSignal -Start

if ([string]::IsNullOrEmpty($SAS)) {
if (-not $SAS) {
Write-PSFMessage -Level Verbose -Message "Working against Azure Storage Account with AccessToken"

$storageContext = New-AzStorageContext -StorageAccountName $AccountId.ToLower() -StorageAccountKey $AccessToken
Expand Down Expand Up @@ -127,4 +127,4 @@ function Get-D365AzureStorageFile {
}

Invoke-TimeSignal -End
}
}
8 changes: 4 additions & 4 deletions d365fo.tools/functions/get-d365azurestorageurl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ function Get-D365AzureStorageUrl {
[switch] $OutputAsHashtable
)

if (([string]::IsNullOrEmpty($AccountId) -eq $true) -or
([string]::IsNullOrEmpty($Container)) -or
([string]::IsNullOrEmpty($SAS))) {
if ((-not $AccountId) -or
(-not $Container) -or
(-not $SAS)) {
Write-PSFMessage -Level Host -Message "It seems that you are missing some of the parameters. Please make sure that you either supplied them or have the right configuration saved."
Stop-PSFFunction -Message "Stopping because of missing parameters"
return
Expand All @@ -97,4 +97,4 @@ function Get-D365AzureStorageUrl {
}

Invoke-TimeSignal -End
}
}
10 changes: 5 additions & 5 deletions d365fo.tools/functions/invoke-d365azurestoragedownload.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ function Invoke-D365AzureStorageDownload {
return
}

if (([string]::IsNullOrEmpty($AccountId) -eq $true) -or
([string]::IsNullOrEmpty($Container)) -or
(([string]::IsNullOrEmpty($AccessToken)) -and ([string]::IsNullOrEmpty($SAS)))) {
if ((-not $AccountId) -or
(-not $Container) -or
((-not $AccessToken) -and (-not $SAS))) {
Write-PSFMessage -Level Host -Message "It seems that you are missing some of the parameters. Please make sure that you either supplied them or have the right configuration saved."
Stop-PSFFunction -Message "Stopping because of missing parameters"
return
Expand All @@ -129,7 +129,7 @@ function Invoke-D365AzureStorageDownload {

try {

if ([string]::IsNullOrEmpty($SAS)) {
if (-not $SAS) {
Write-PSFMessage -Level Verbose -Message "Working against Azure Storage Account with AccessToken"

$storageContext = New-AzStorageContext -StorageAccountName $AccountId.ToLower() -StorageAccountKey $AccessToken
Expand Down Expand Up @@ -179,4 +179,4 @@ function Invoke-D365AzureStorageDownload {
}

END { }
}
}
12 changes: 6 additions & 6 deletions d365fo.tools/functions/invoke-d365azurestorageupload.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ function Invoke-D365AzureStorageUpload {
[switch] $EnableException
)
BEGIN {
if (([string]::IsNullOrEmpty($AccountId) -eq $true) -or
([string]::IsNullOrEmpty($Container)) -or
(([string]::IsNullOrEmpty($AccessToken)) -and ([string]::IsNullOrEmpty($SAS)))) {
if ((-not $AccountId) -or
(-not $Container) -or
((-not $AccessToken) -and (-not $SAS))) {
Write-PSFMessage -Level Host -Message "It seems that you are missing some of the parameters. Please make sure that you either supplied them or have the right configuration saved."
Stop-PSFFunction -Message "Stopping because of missing parameters"
return
Expand All @@ -121,7 +121,7 @@ function Invoke-D365AzureStorageUpload {
$FileName = Split-Path -Path $Filepath -Leaf
try {

if ([string]::IsNullOrEmpty($SAS)) {
if (-not $SAS) {
Write-PSFMessage -Level Verbose -Message "Working against Azure Storage Account with AccessToken"

$storageContext = New-AzStorageContext -StorageAccountName $AccountId.ToLower() -StorageAccountKey $AccessToken
Expand All @@ -136,7 +136,7 @@ function Invoke-D365AzureStorageUpload {

Write-PSFMessage -Level Verbose -Message "Start uploading the file to Azure"

if ([string]::IsNullOrEmpty($ContentType)) {
if (-not $ContentType) {
$ContentType = [System.Web.MimeMapping]::GetMimeMapping($Filepath) # Available since .NET4.5, so it can be used with PowerShell 5.0 and higher.

Write-PSFMessage -Level Verbose -Message "Content Type is automatically set to value: $ContentType"
Expand Down Expand Up @@ -165,4 +165,4 @@ function Invoke-D365AzureStorageUpload {
}

END { }
}
}
Loading