title: Why az login command does not work on Azure when executed with power shell command that runs from dot net code?
body: <p>I have an ASP.Net Web Application which tries to log into Azure using power shell commands. The following code is being used for this purpose:</p>
  
  <pre><code>        Runspace runspace = RunspaceFactory.CreateRunspace();
          runspace.Open();
          Pipeline pipeline = runspace.CreatePipeline();
          pipeline.Commands.AddScript("az login -u 'vtripathi@hsdyn.com' -p '********'");
          pipeline.Commands.Add("Out-String");
          var output = pipeline.Invoke();
          string result = output[0].ToString();
  </code></pre>
  
  <p>The problem here is that when I run this application locally on my system, it manages to log into Azure successfully, but when I deploy the same application on Azure app service, I get the below error:</p>
  
  <pre><code>Server Error in '/' Application.    
  The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
  </code></pre>
  
  <p>Please suggest what might be wrong.</p>