title: How to obtain authtoken for request via powershell
body: <p>I need to add an authorization token to a request I'm making via powershell. In c#, I can get the token like this:</p>
  
  <pre><code>private static string GetAccessToken()
      {
          AuthenticationContext authContext = new AuthenticationContext(((MyApp)Application.Current).AuthorityAddress);
          Task&lt;AuthenticationResult&gt; resultTask = authContext.AcquireTokenAsync(
              (myAuthServerAddress,
              clientId,
              redirectUri,
              new Microsoft.IdentityModel.Clients.ActiveDirectory.PlatformParameters(PromptBehavior.Auto, false));
  
          resultTask.Wait();
          return resultTask.Result.AccessToken;
      }
  </code></pre>
  
  <p>How would I do this in powershell? I need to get that token to add as a header:</p>
  
  <pre><code>Authorization: Bearer blahblahblahtokenblahblah
  </code></pre>