Skip to content

Latest commit

 

History

History
141 lines (108 loc) · 6.12 KB

script-subscription.adoc

File metadata and controls

141 lines (108 loc) · 6.12 KB

subscription.py

Create management groups and subscriptions

Note
Before Using
  • Authenticate with Azure before invoking the script.

  • Be sure that you are in the root folder of the toolkit.

  • Make sure to login with an account owner to be able to create Management groups and Subscriptions.

Commands

This script offers the following commands:

  • create-subscription creates a new subscription.

  • create-management-group creates a new management group.

  • associate-management-group associates and existing subscription with a management group.

create-subscription

Docker
python subscription.py create-subscription {arguments}
Linux/OSX
python3 subscription.py create-subscription {arguments}
Windows
py subscription.py create-subscription {arguments}

Arguments

Argument Required? Description
--subscription-name

Required

The name of the subscription to create.

--offer-type

Required

Azure’s subscription offer type (i.e. MS-AZR-0017P).

--billing-enrollment-name

Optional

If not passed, the code will look for a default billing enrollment account name (first value found).

create-management-group

Docker
python subscription.py create-management-group {arguments}
Linux/OSX
python3 subscription.py create-management-group {arguments}
Windows
py subscription.py create-management-group {arguments}

Arguments

Argument Required? Description
--id

Required

The id of the management group to be created.

--subscription-id

Optional

If specified, the subscription gets associated to the new management group.

--subscription-name

Optional

If specified, the script will try to identify the subscription id by its name) and then associated it to the management group created. Passing subscription-name will make an additional API call to retrieve the subscriptions based on the name, we recommend using subscription-id instead.

associate-management-group

Docker
python subscription.py associate-management-group {arguments}
Linux/OSX
python3 subscription.py associate-management-group {arguments}
Windows
py subscription.py associate-management-group {arguments}

Arguments

Argument Required? Description
--management-group-id

Required

The id of the management group to be associated to the specified subscription.

--subscription-id

Required

The id of the subscription to be associated to the specified management group.