IT Automation in Studio Web - Virtual Machine provisioning (AWS, Azure, GCP)

This workflow guide showcases how you can leverage the UiPath IT Automation official activities in Studio Web to automate scenarios related to managing and provisioning application servers in the Cloud.

Automation Steps

1. Add in-argument to select the Cloud where the VM will be created

The destination cloud can differ for each task / request, so we’ll create in the Data Manager area an InArgument of type Text (possible values aws , azure , gcp ).
We also add the VM_Name in-argument of type Text (to be used as input in the CreateVM activities).

2. Evaluate Cloud in-argument

The Switch activity from the System package is used to decide which cloud will host the new VM; we binds the activity’s Expression mandatory input to the Cloud in-argument and add aws , azure and gcp as valid Switch cases.

For possible invalid values, we add in the Default case a Throw activity from the System package and set as value for the Exception input (via the Expression Editor) the value New Exception(“Not Implemented”)

3. Add cloud connection details in the Orchestrator assets

The UiPath IT Automation integrations use activities of type Scope for connections. We’ll use Orchestrator Assets as credentials store (embedding passwords and secrets in automations is not recommended).

4. Configuring the Amazon Web Services Scope

We uses the Get Credential activity from the System package to retrieve the value of the AWS_Key Orchestrator asset.

The credential’s username is used as value for the Amazon Web Services Scope activity’s Access Key ID ’s input and the credential’s password as value for the Secret Access Key input.

5. Configuring the Azure Scope

We use the Get Credential and Get Asset activities from the System package to retrieve the values of the following Orchestrator Assets: Azure_SubscriptionID, Azure_TenantID, Azure_AppRegistration.

Ana uses the Azure_AppRegistration credential’s username as value for the Azure Scope activity’s Client ID ’s input and the password as value for the Client Secret input.


image

6. Configuring the Google Cloud Scope

We use the Get Asset activity from the System package to retrieve the value of the following Orchestrator Assets: GCP_ServiceAccountKey.

We use the GCP_ServiceAccountKey ’s asset’s value for the Google Cloud Scope activity’s Client ID ’s input by creating a SecureString object from it in the Expression Editor:
New System.Net.NetworkCredential(“”,___map_GetRobotAsset_5__Value.ToString).SecurePassword

The GCP Scope also supports passing as input the Key file - can be loaded externally or even embedded in the project (not recommended).

7. Creating a new VM in Azure

In order to create a new VM in Azure, we add to the project the Get VM Image By Publisher and Create VM activities from the Azure package. After the provisioning step, we also would like to log the VMs list, so we also add the Get VM List (Azure package), ForEach , Log Message (System package) activities:

We’ll use as a template for the new VMs a public Windows Server image:

The Create VM activity is configured to use the VM image retrieved by previous activity; VM Size, Region, Resource Group Name, Admin user and password are also pre-configured:

We to list the VM names from the predefined Resource Group for audit and debugging reasons:

8. Creating a new VM (EC2 instance) in Amazon Web Services

In order to create a new VM in AWS, we add to the project the Create Instance activity from the Amazon Web Services package. After the provisioning step, we want to log the VMs list, so we also add the Get Instances List (Amazon Web Services package), ForEach , Log Message (System package) activities:

The Create VM activity is configured to use a predefined VM image; VM Instance Size is also pre-configured and the Instance Name input is connected to the VM_Name in-argument:

We list the VM names for audit and debugging reasons; if needed, the Get Instances List activity allows her to filter the list (eg by instance Tag values):

9. Creating a new VM instance in Google Cloud

In order to create a new VM in GCP, we add to the project the Create Instance activity from the Google Cloud package. After the provisioning step, we want to log the VMs list, so we also add the For Each Instance (GCP package) and Log Message (System package) activities:

The Create Instance activity is configured to use a predefined Debian Linux VM source; VM’s Type, Project ID, Zone are also pre-configured and the Instance Name input is connected to the VM_Name in-argument:

We list the VM names for audit and debugging reasons and use the For Each Instance activity from the GCP package; the activity allows us to easily iterate through the VMs list and also offers powerful filtering capabilities:

Demo project

ITAutomation_CloudCreateVM.zip (4.4 KB)

Demo video

1 Like