Skip to content

Getting Started

bganapa edited this page Jun 18, 2021 · 15 revisions

Welcome to AzureStack Powershell repository!

The repo holds the modules for the AzureStack Hub operator persona. The Azurestack hub admin APIs are exposed as powershell via this repo

Most of the modules are generated with the autorest tool (https://github.com/Azure/autorest.powershell) and some modules are hand written.

Contents

/src folder

This is for source of all the admin api modules. This could also contain the helper cmdlets over azurestack/azure integration For many of the modules only the metadata configuration files would be present as the modules are generated as described in the following sections

/tools folder

This contains files that are essential for devops pipelines and security scans

/docs folder

This contains the migration guides and general information docs

Dev Setup

Prerequisites

  1. Install NodeJs: https://nodejs.org/ (recommended v14.17.0 plus, )
  2. install new autorest beta package:
npm install -g autorest 
  1. Install PS core:
npm install -g pwsh
  1. Install .net core:
npm install -g dotnet-sdk-2.2

Build

  1. Go to module directory, e.g. src/Azs.Network.Admin
  2. Run:
    • autorest
    • pwsh
    • .\build-module.ps1
  3. All generated cmdlets will be inside 'exports' folder
  4. The module can be imported using the 'Azs..Admin.psd1' (e.g. Azs.Network.Admin.psd1) from the module directory

Customizations:

The docs for cusotmization can be found under https://github.com/Azure/autorest.powershell/tree/master/docs

  • Input specs files: declare it inside the readme.md file in the azure-rest-api-specs repo using input-file cmd e.g.
input-file:
    - "$(this-folder)/Microsoft.Network.Admin/preview/2015-06-15/Network.json"
    - "$(this-folder)/Microsoft.Network.Admin/preview/2015-06-15/LoadBalancers.json"
    - "$(this-folder)/Microsoft.Network.Admin/preview/2015-06-15/PublicIpAddresses.json" 
    - "$(this-folder)/Microsoft.Network.Admin/preview/2015-06-15/Quotas.json"
    - "$(this-folder)/Microsoft.Network.Admin/preview/2015-06-15/VirtualNetworks.json"
  • Include the above file in the azure-powershell module directory's readme.md file using require cmd
require:
  - $(repo)/specification/azsadmin/resource-manager/network/readme.md

$(repo) and other common settings are defined in the file

Tests

Pester tests are required to make sure that cmdlets are validated against a live AzureStack Hub environment. Also to make sure that the future changes are not breaking the cmdlets. We follow the record and playback framework used by the Azure Powershell team. The docs for authoring the tests can be found at the following wiki https://github.com/Azure/azure-powershell/wiki/How-to-On-Board-New-RP-with-Azure-PowerShell-Generator#test

Clone this wiki locally