How to install Az module on Windows Server through DevOps

0 votes

 I have to execute the PS script on one of the APIs in my .Net Core application. Previously I used AzureRm commands in my PS script with the .Net framework. But after upgrading to .Net Core this script stopped working. Then I updated the PS script to use Az commands then it gave me an error :

"The specified module 'Az' was not loaded because no valid module file was found in any module directory."

DevOps Powershell Script to install Az module:

Install-Module -Name Az -RequiredVersion 2.8.0 -Force -AllowClobber 

Get-InstalledModule #Just print out the details to confirm whether `Az 2.8.0` has been installed successfully

// Even setting PSModulePath is not working

$key = (Get-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager').OpenSubKey('Environment', $true)

$path = $key.GetValue('PSModulePath','','DoNotExpandEnvironmentNames')

$path += ';D:\Program Files (x86)\ManagedDependencies\PowerShell\AzPSModules\1.0.0'

$key.SetValue('PSModulePath',$path,[Microsoft.Win32.RegistryValueKind]::ExpandString)

What should I do to execute the Az command in the PS script?

Apr 14, 2022 in Other DevOps Questions by Kichu
• 19,040 points
570 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Other DevOps Questions

0 votes
0 answers

how to install ADOP a.k.a. Accenture devops platform in local desktop without using server?

I came to know that ADOP a.k.a. ...READ MORE

Mar 26, 2022 in Other DevOps Questions by Kichu
• 19,040 points
466 views
0 votes
0 answers

How do I add the azure-devops commands to the Azure CLI in an offline on-premise server?

I wanted to add the azure-DevOps extension to the Azure ...READ MORE

Apr 19, 2022 in Other DevOps Questions by Kichu
• 19,040 points
558 views
0 votes
1 answer

How do I install Maven on Windows?

Hey @Laksha, to install Apache Maven all ...READ MORE

answered Feb 19, 2019 in Other DevOps Questions by Kashish
1,049 views
0 votes
1 answer

How to integrate OnPrem Azure DevOps Server with the cloud one?

When I go to Project > Boards ...READ MORE

answered Feb 11, 2022 in Other DevOps Questions by Bhavitha
• 1,000 points
617 views
0 votes
0 answers
0 votes
1 answer

powerbi embeded in .net core 1.1

See if it helps: https://www.nuget.org/packages/PowerBI.NetStandar ...READ MORE

answered Nov 28, 2018 in Power BI by Upasana
• 8,620 points
1,503 views
0 votes
1 answer

Power BI Embedded : Importing Packages

This should help you out. https://www.nuget.org/packages/PowerBI.N ...READ MORE

answered Apr 3, 2019 in Power BI by Shubham
• 13,490 points
716 views
0 votes
0 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP