Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
chzar authored May 12, 2021
1 parent af657a7 commit 35bf368
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,22 @@ az = Az()

# create 'shortcut' functions
get_account = lambda: az.run('account show'.split()).id
make_vnet = lambda opts: az.run('network vnet create'.split(), options_dict=opts)

# get account id
account_id = get_account()
account_id = az.run('account show').id

# pass in cmdline options in a dictionary
output = make_vnet({'name': 'vnet1', 'resource-group': 'MyResourceGroup'})
output = az.run('network vnet create', options_dict={'name': 'vnet1', 'resource-group': 'MyResourceGroup'})

# deploy an arm template in code
vnet2_deployment = az.deploy(tmpl, 'MyResourceGroup', DeploymentScope.ResourceGroup)

# returned objects are lists and SimpleNamespace objects
first_rg = az.run('group list'.split())[0].name
first_rg = az.run('group list')[0].name

# error handling
try:
print(az.run("group lt".split()))
print(az.run("group lt"))
except AzCommandSyntaxError as e:
print(e.stdout)
print(e.stderr)
Expand Down

0 comments on commit 35bf368

Please sign in to comment.