diff --git a/CHANGELOG.md b/CHANGELOG.md index a0d5734..7112049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added new utillity function `Get-CosmosDbAuthorizationHeaderFromContextEntraId` to generate the authorization header when an Entra ID Token is provided in the context. This function is used by `Invoke-CosmosDbRequest` to generate the authorization header when an Entra ID Token is provided. +- Changed module import process to load the `Az.Accounts` and `Az.Resources` modules + only if they haven't already been loaded to support saving the module and storing in + folders. ### Added diff --git a/source/prefix.ps1 b/source/prefix.ps1 index 633de69..d82022b 100644 --- a/source/prefix.ps1 +++ b/source/prefix.ps1 @@ -9,9 +9,16 @@ $script:moduleRoot = Split-Path ` -Path $MyInvocation.MyCommand.Path ` -Parent -# Import dependent Az modules -Import-Module -Name Az.Accounts -MinimumVersion 2.19.0 -Scope Global -Import-Module -Name Az.Resources -MinimumVersion 6.16.2 -Scope Global +# Import dependent Az modules ifthey are not already imported +if (-not (Get-Module -Name Az.Accounts)) +{ + Import-Module -Name Az.Accounts -MinimumVersion 2.19.0 -Scope Global +} + +if (-not (Get-Module -Name Az.Resources)) +{ + Import-Module -Name Az.Resources -MinimumVersion 6.16.2 -Scope Global +} #region LocalizedData $culture = $PSUICulture