@@ -94,8 +94,8 @@ function Import-FromModulePath {
9494 }
9595
9696 # Import the module.
97- Write-Host " ##[command]Import-Module -Name $ ( $module.Path ) -Global"
98- $module = Import-Module - Name $module.Path - Global - PassThru
97+ Write-Host " ##[command]Import-Module -Name $ ( $module.Path ) -Global -Force "
98+ $module = Import-Module - Name $module.Path - Global - PassThru - Force
9999 Write-Verbose " Imported module version: $ ( $module.Version ) "
100100
101101 if ($Classic ) {
@@ -117,8 +117,8 @@ function Import-FromModulePath {
117117 throw (Get-VstsLocString - Key AZ_AzureRMProfileModuleNotFound)
118118 }
119119 # Import and then store the AzureRM.profile module.
120- Write-Host " ##[command]Import-Module -Name $ ( $profileModule.Path ) -Global"
121- $script :azureRMProfileModule = Import-Module - Name $profileModule.Path - Global - PassThru
120+ Write-Host " ##[command]Import-Module -Name $ ( $profileModule.Path ) -Global -Force "
121+ $script :azureRMProfileModule = Import-Module - Name $profileModule.Path - Global - PassThru - Force
122122 } else {
123123 $script :azureRMProfileModule = $profileModule
124124 }
@@ -156,8 +156,8 @@ function Import-FromSdkPath {
156156 continue
157157 }
158158 # Import the module.
159- Write-Host " ##[command]Import-Module -Name $path -Global"
160- $module = Import-Module - Name $path - Global - PassThru
159+ Write-Host " ##[command]Import-Module -Name $path -Global -Force "
160+ $module = Import-Module - Name $path - Global - PassThru - Force
161161 Write-Verbose " Imported module version: $ ( $module.Version ) "
162162 # Store the imported module.
163163 if ($Classic ) {
@@ -197,8 +197,8 @@ function Import-AzureRmSubmodulesFromSdkPath {
197197 try {
198198 # Azure.Storage submodule needs to be imported first
199199 $azureStorageModulePath = [System.IO.Path ]::Combine($programFiles , " Microsoft SDKs\Azure\PowerShell\Storage\Azure.Storage\Azure.Storage.psd1" )
200- Write-Host " ##[command]Import-Module -Name $azureStorageModulePath -Global"
201- $azureStorageModule = Import-Module - Name $azureStorageModulePath - Global - PassThru
200+ Write-Host " ##[command]Import-Module -Name $azureStorageModulePath -Global -Force "
201+ $azureStorageModule = Import-Module - Name $azureStorageModulePath - Global - PassThru - Force
202202 Write-Verbose " Imported module version: $ ( $azureStorageModule.Version ) "
203203 }
204204 catch {
@@ -215,8 +215,8 @@ function Import-AzureRmSubmodulesFromSdkPath {
215215 }
216216 $azureRmNestedModulePath = [System.IO.Path ]::Combine($azureRmNestedModule.FullName , $azureRmNestedModule.Name + " .psd1" )
217217 try {
218- Write-Verbose " ##[command]Import-Module -Name $azureRmNestedModulePath -Global"
219- $azureRmSubmodule = Import-Module - Name $azureRmNestedModulePath - Global - PassThru
218+ Write-Verbose " ##[command]Import-Module -Name $azureRmNestedModulePath -Global -Force "
219+ $azureRmSubmodule = Import-Module - Name $azureRmNestedModulePath - Global - PassThru - Force
220220 Write-Verbose " Imported module version: $ ( $azureRmSubmodule.Version ) "
221221 }
222222 catch {
0 commit comments