* Add the folder path where Az modules are present to PSModulePath based on runner * @param azPSVersion * If azPSVersion is empty, folder path in which all Az modules are present are set * If azPSVersion is not empty, folder path of exact Az module version is set
(azPSVersion: string = "")
| 14 | * If azPSVersion is not empty, folder path of exact Az module version is set |
| 15 | */ |
| 16 | static async setPSModulePath(azPSVersion: string = "") { |
| 17 | let output: string = ""; |
| 18 | const options: any = { |
| 19 | listeners: { |
| 20 | stdout: (data: Buffer) => { |
| 21 | output += data.toString(); |
| 22 | } |
| 23 | } |
| 24 | }; |
| 25 | await PowerShellToolRunner.executePowerShellScriptBlock("$env:PSModulePath", options); |
| 26 | const defaultPSModulePath = output.trim(); |
| 27 | |
| 28 | const runner: string = process.env.RUNNER_OS || os.type(); |
| 29 | let defaultAzInstallFolder:string = Utils.getDefaultAzInstallFolder(runner.toLowerCase()); |
| 30 | let modulePath: string = path.join(defaultAzInstallFolder, `${azPSVersion}`); |
| 31 | process.env.PSModulePath = `${modulePath}${path.delimiter}${defaultPSModulePath}`; |
| 32 | } |
| 33 | |
| 34 | static getDefaultAzInstallFolder(os:string): string{ |
| 35 | let defaultAzInstallFolder = ""; |
no test coverage detected