-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure_deployment.py
More file actions
30 lines (22 loc) · 1.29 KB
/
azure_deployment.py
File metadata and controls
30 lines (22 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os.path
from deployer import Deployer
# This script expects that the following environment vars are set:
#
# AZURE_TENANT_ID: with your Azure Active Directory tenant id or domain
# AZURE_CLIENT_ID: with your Azure Active Directory Application Client ID
# AZURE_CLIENT_SECRET: with your Azure Active Directory Application Secret
my_subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', '11111111-1111-1111-1111-111111111111') # your Azure Subscription Id
my_resource_group = 'azure-python-deployment-sample' # the resource group for deployment
my_pub_ssh_key_path = os.path.expanduser('~/.ssh/id_rsa.pub') # the path to your rsa public key file
msg = "\nInitializing the Deployer class with subscription id: {}, resource group: {}" \
"\nand public key located at: {}...\n\n"
msg = msg.format(my_subscription_id, my_resource_group, my_pub_ssh_key_path)
print(msg)
# Initialize the deployer class
deployer = Deployer(my_subscription_id, my_resource_group, my_pub_ssh_key_path)
print("Beginning the deployment... \n\n")
# Deploy the template
my_deployment = deployer.deploy()
print("Done deploying!!\n\nYou can connect via: `ssh azureSample@{}.westus.cloudapp.azure.com`".format(deployer.dns_label_prefix))
# Destroy the resource group which contains the deployment
# deployer.destroy()