Skip to content

Latest commit

 

History

History

docs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

AutoRest PowerShell Generator

Requirements

Use of the beta version of autorest.powershell requires the following:

  • NodeJS LTS (14.x LTS preferred. Will not function with Node < 10.x. )

if you want an easy way to install and update Node, I recommend NVS - Node Version Switcher or NVM - Node Version Manager

  • AutoRest v3
    npm install -g autorest
     
  • PowerShell 6.0 - If you dont have it installed, you can use the cross-platform npm package
    npm install -g pwsh
     
  • Dotnet SDK 2 or greater - If you dont have it installed, you can use the cross-platform npm package
    npm install -g dotnet-sdk-2.1
     

Users Quick Links

Developers Quick Links

Installing AutoRest Beta and the PowerShell generator

To use the PowerShell generator, you have to first install the AutoRest v3:

# Installing AutoRest (beta)
> npm install -g "autorest" 

# if you have a previous version installed (or want it to pull the latest version), reset the autorest plugins
> autorest --reset

Returning to the release version of the generator

If you run into a problem, and need to return to the release version of the generator

# Installing AutoRest (release)
> npm install -g autorest

# remove all the installed plugins
> autorest --reset

Using AutoRest Powershell

At a bare minimum, you can generate a powershell module using a swagger or openapi file and using --powershell.

The output will be in the ./generated folder by default

# AutoRest command line
> autorest --powershell --input-file:<path-to-swagger-file> [...options]

Common AutoRest parameters:

  • --powershell - required to use the powershell generator
  • --input-file:<OpenAPI2 or OpenAPI3 file> - the OpenAPI2/OpenAPI3/Swagger (.json or .yaml) file to generate the module from
  • --output-folder:<folder> - you can specify where the output is to be generated
  • --verbose - get verbose information from autorest as to what is going on
  • --debug - get debug information from autorest as to what is going on
  • --clear-output-folder - to clear out previous generated files in the output folder (except files in the custom folder)

More Information