diff --git a/d365fo.tools/functions/get-d365azurestoragefile.ps1 b/d365fo.tools/functions/get-d365azurestoragefile.ps1 index e20ca8e8..ae2aeff0 100644 --- a/d365fo.tools/functions/get-d365azurestoragefile.ps1 +++ b/d365fo.tools/functions/get-d365azurestoragefile.ps1 @@ -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 @@ -127,4 +127,4 @@ function Get-D365AzureStorageFile { } Invoke-TimeSignal -End -} \ No newline at end of file +} diff --git a/d365fo.tools/functions/get-d365azurestorageurl.ps1 b/d365fo.tools/functions/get-d365azurestorageurl.ps1 index 2827e948..a52d13fc 100644 --- a/d365fo.tools/functions/get-d365azurestorageurl.ps1 +++ b/d365fo.tools/functions/get-d365azurestorageurl.ps1 @@ -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 @@ -97,4 +97,4 @@ function Get-D365AzureStorageUrl { } Invoke-TimeSignal -End -} \ No newline at end of file +} diff --git a/d365fo.tools/functions/invoke-d365azurestoragedownload.ps1 b/d365fo.tools/functions/invoke-d365azurestoragedownload.ps1 index 9f41522e..b064c64b 100644 --- a/d365fo.tools/functions/invoke-d365azurestoragedownload.ps1 +++ b/d365fo.tools/functions/invoke-d365azurestoragedownload.ps1 @@ -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 @@ -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 @@ -179,4 +179,4 @@ function Invoke-D365AzureStorageDownload { } END { } -} \ No newline at end of file +} diff --git a/d365fo.tools/functions/invoke-d365azurestorageupload.ps1 b/d365fo.tools/functions/invoke-d365azurestorageupload.ps1 index 5bfe6dd3..6d6c1643 100644 --- a/d365fo.tools/functions/invoke-d365azurestorageupload.ps1 +++ b/d365fo.tools/functions/invoke-d365azurestorageupload.ps1 @@ -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 @@ -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 @@ -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" @@ -165,4 +165,4 @@ function Invoke-D365AzureStorageUpload { } END { } -} \ No newline at end of file +}