i wanted to execute the az login using System.Management.Automation. its working in my local. when i tried to deploy the same in web server, the system is not recognizing AZ comments,
Note: I've already installed AZ cmdlets
public class ValuesController : ApiController
{
// GET api/values
public IList<PSObject> Get()
{
using (PowerShell ps = PowerShell.Create())
{
ps.AddScript("Import-Module Azure; az login");
var token = ps.Invoke();
return token;
}
}
}