@@ -19,9 +19,9 @@ async function run() {
1919
2020 const env = process . env ;
2121 const hostEnv = `ADO/AzurePowerShell@v5_${ env . AGENT_OS || "" } _${ env . AGENT_NAME || "" } _${ env . BUILD_DEFINITIONNAME || "" } _${ env . BUILD_BUILDID || "" } _${ env . RELEASE_DEFINITIONNAME || "" } _${ env . RELEASE_RELEASEID || "" } ` ;
22-
22+
2323 process . env . AZUREPS_HOST_ENVIRONMENT = hostEnv ;
24- console . log ( `AZUREPS_HOST_ENVIRONMENT: ${ hostEnv } ` ) ;
24+ console . log ( `AZUREPS_HOST_ENVIRONMENT: ${ hostEnv } ` ) ;
2525
2626 try {
2727 tl . setResourcePath ( path . join ( __dirname , 'task.json' ) ) ;
@@ -137,14 +137,15 @@ async function run() {
137137 //
138138 // Note, use "-Command" instead of "-File" to match the Windows implementation. Refer to
139139 // comment on Windows implementation for an explanation why "-Command" is preferred.
140+ const importSdk = path . join ( path . resolve ( __dirname ) , 'ImportVstsTaskSdk.ps1' ) ;
140141 let powershell = tl . tool ( tl . which ( 'pwsh' ) || tl . which ( 'powershell' ) || tl . which ( 'pwsh' , true ) )
141142 . arg ( '-NoLogo' )
142143 . arg ( '-NoProfile' )
143144 . arg ( '-NonInteractive' )
144145 . arg ( '-ExecutionPolicy' )
145146 . arg ( 'Unrestricted' )
146147 . arg ( '-Command' )
147- . arg ( `. '${ filePath . replace ( / ' / g, "''" ) } '` ) ;
148+ . arg ( `. '${ importSdk } '; . ' ${ filePath . replace ( / ' / g, "''" ) } '` ) ;
148149
149150 let options = < tr . IExecOptions > {
150151 cwd : input_workingDirectory ,
@@ -187,7 +188,7 @@ async function run() {
187188 . arg ( '-ExecutionPolicy' )
188189 . arg ( 'Unrestricted' )
189190 . arg ( '-Command' )
190- . arg ( `. '${ path . join ( path . resolve ( __dirname ) , 'RemoveAzContext.ps1' ) } '` ) ;
191+ . arg ( `. '${ path . join ( path . resolve ( __dirname ) , 'RemoveAzContext.ps1' ) } '` ) ;
191192
192193 let options = < tr . IExecOptions > {
193194 cwd : input_workingDirectory ,
@@ -207,7 +208,7 @@ async function run() {
207208async function getInstalledAzModuleVersion ( ) : Promise < string | null > {
208209 try {
209210 tl . debug ( 'Checking installed Az PowerShell module version...' ) ;
210-
211+
211212 // PowerShell command to get the installed Az module version
212213 const powershell = tl . tool ( tl . which ( 'pwsh' ) || tl . which ( 'powershell' ) || tl . which ( 'pwsh' , true ) )
213214 . arg ( '-NoLogo' )
@@ -217,7 +218,7 @@ async function getInstalledAzModuleVersion(): Promise<string | null> {
217218 . arg ( 'Unrestricted' )
218219 . arg ( '-Command' )
219220 . arg ( `. '${ path . join ( path . resolve ( __dirname ) , 'Utility.ps1' ) } '; Get-InstalledMajorRelease -moduleName 'Az' -iswin $false` ) ;
220-
221+
221222 const result = await powershell . execSync ( )
222223 if ( result . code === 0 && result . stdout ) {
223224 const version = result . stdout . trim ( ) ;
0 commit comments