In this lab, we will configure the Bastion service, virtual machine updates, virtual machine extensions,
and disk encryption. Optionally, we will use RDP to connect to a Windows virtual machine and SSH to connect to a
Linux machine.
Task 1 - Use the Bastion service
Note: This task requires a virtual machine. If you are doing the next task, virtual machine updates, use a Windows
virtual machine and keep the session running.
In this task, we will configure the Bastion service and connect to a virtual machine with service.
Configure the Bastion service
- In the Portal navigate to your Windows virtual machine.
- Ensure the virtual machine is Running.
- Click Connect and select Bastion.
- Click Use Bastion. Note installing the service is only required once.
- Because you are creating the Bastion service from the target virtual machine, mention that most of the networking information has automatically been filled in. Note the Bastion service will be assigned a public IP address.
- To create the Bastion subnet in the virtual network, click Manage subnet configuration.
- On the virtual network subnet blade, click + Subnet.
- On the Add subnet page, type AzureBastionSubnet as the subnet name. Note this name cannot be changed.
- Specify the address range in CIDR notation. For example, 10.1.1.0/27.
- Click Ok, then click Create. It will take a few minutes for the service to deploy.
Connect to the virtual machine using Bastion
- From the target virtual machine’s Overview blade, select Connect and then Bastion
- On the Connect to Bastion page, enter the virtual machine login credentials.
- Notice the checkbox to open the session in a new window.
- Click Connect. If you receive a message that popup windows are blocked, allow the session.
- Once your session is connected, launch the Bastion clipboard access tool palette by selecting the two arrows. The arrows are located on the left center of the session. Explain this copy and paste feature.
- In the Portal, navigate to the Basion host and under Settings select Sessions.
- Review the session management experience and the ability to delete a session.
- As you have time, review the Bastion components and how this provides a secure way to access your virtual machines.
Task 2 - Virtual Machine Updates
Note: This task requires a virtual machine in the running state. You may want to enable Update management
prior to this lesson.
In this task, we will review virtual machine update management.
- In the Portal, navigate to your virtual machine.
- Under Operations select Update management.
- Select the Azure Log Analytics workspace and Automation account, and then click Enable.
- Wait for update management to deploy. It can take up to 15 minutes for the deployment and longer for results to be provided.
- Select Missing Updates and use the Information link to open the support article for the update.
- Select Schedule update deployment.
- Review the various options including maintenance windows, reboot options, scheduling, classifications, kbs to include and exclude.
- You can view the status for the deployment on the Update deployments tab. The available values are not attempted, succeeded, and failed.
Task 3 - Virtual Machine Extensions
In this task, we will install the IaaSAntimalware extension.
- In the Portal, select your virtual machine.
- Under Settings, click Extensions. Review how extensions are used.
- On the Extensions page, click + Add.
- Scroll through the available extensions and review what extensions are available.
- Select Microsoft Antimalware. Discuss the features of this extension
- Click Create.
- On the Install extension page use the informational icons to explain Excluded files and locations, Excluded file extensions, and Excluded processes.
- Review Real-time protection and Run a scheduled scan.
- Review other options of interest.
- After the extension is deployed, the extensions page will show the IaaSAntimalware extension.
Task 4 - Disk Encryption
Note: This task requires a storage account.
In this task, we will enable disk encryption for a storage account.
Review encryption key options
- In the Portal, access your storage account.
- Under Settings select Encryption.
- Review Storage Service Encryption and why it is used.
- Review the two types of keys: Microsoft Managed Keys and Customer Managed Keys.
- Select Customer Managed Keys.
Create the customer managed key
- For Encryption key choose Select from key vault.
- Click Select a key vault and key.
- You will now create a new key vault. If you already had a key vault you could use that.
- For Key vault select Create new.
- Notice the key vault will be created in the same region as the storage account.
- Give your key vault a name.
- Click Review + create.
- Once the validation passes, click Create.
- Wait for the key vault to be created.
- You will now create a key in the key vault. If you already had a key you could use that.
- On the Select key from Azure key vault page, for Key select - Create new.
- Review the options for creating a key.
- Give your key a name.
- Notice the activation and expiration options.
- Click Create.
- Now that you have created a key vault and key, Select the key vault and key.
- Save your changes on the Encryption page.
- Review the information that is now available: Current key, Automated key rotation, and Key version in use.
Review the key options
- Return to the resource group that includes your storage account.
- Refresh the page and ensure your new key vault is listed as a resource.
- Select the key vault.
- Under Settings click Keys
- Ensure your new key is Enabled. Notice the ability to regenerate the key.
- Select the key and review the current version information.
- Return to the key vault page.
- Under Settings select Access policies.
- Under Current access policies your storage account will be listed.
- Notice the drop-downs for Key Permissions, Secret Permissions, and Certificate Permissions.
- Select Key Permissions and notice the properties that are checked (Get, Unwrap key, and Wrap key).
Task 5 - Use RDP to connect to a Windows VM
Note: This task requires a Windows VM with a public IP address. You also need the login credentials for the
machine.
In this task, we will use RDP to connect to a Windows virtual machine.
- In the Portal navigate to your Windows virtual machine.
- Ensure the virtual machine is Running.
- From the Overview blade select Connect and then RDP.
- In the Connect to virtual machine page, keep the default options to connect by DNS name over port 3389 and click Download RDP file.
- Mention that if the VM has a just-in-time policy set, you first need to select the Request access button to request access before you can download the RDP file.
- Open the downloaded RDP file and then click Connect.
- In the Windows Security window, select More choices and then Use a different account.
- Type the username as localhost\username, enter password you created for the virtual machine, and then select OK.
- You may receive a certificate warning during the sign-in process. Select Yes or Continue to create the connection.
- Explain how RDP is different from the Bastion service
Task 6 - Use SSH to connect to a Linux VM
Note: This task requires a Linux VM. Ensure port 22 is open.
In this task, we will create a SSH private key with PuTTYgen, and then use SSH to connect to a Linux virtual
machine.
Create the SSH Keys
- Download the PuTTY tool. This will include PuTTYgen - https://putty.org/.
- Once installed, locate and open the PuTTYgen program.
- In the Parameters option group choose RSA.
- Click the Generate button.
- Move your mouse around the blank area in the window to generate some randomness.
- Copy the text of the Public key for pasting into authorized keys file.
- Optionally you can specify a Key passphrase and then Confirm passphrase. You will be prompted for the passphrase when you authenticate to the VM with your private SSH key. Without a passphrase, if someone obtains your private key, they can sign in to any VM or service that uses that key. We recommend you create a passphrase. However, if you forget the passphrase, there is no way to recover it.
- Click Save private key.
- Choose a location and filename and click Save. You will need this file to access the VM.
Create the Linux machine and assign the public SSH key
- In the portal navigate to your Linux machine.
- Choose SSH Public Key for the Authentication type (instead of Password ).
- Provide a Username.
- Paste the public SSH key from PuTTY into the SSH public key text area. Ensure the key validates with a checkmark.
- Create the VM. Wait for it to deploy.
- Access the running VM.
- From the Overview blade, click Connect.
- Make a note of your login information including user and public IP address.
Access the server using SSH
- Open the PuTTY tool.
- Enter username@publicIpAddress where username is the value you assigned when creating the VM and publicIpAddress is the value you obtained from the Azure portal.
- Specify 22 for the Port.
- Choose SSH in the Connection Type option group.
- Navigate to SSH in the Category panel, then click Auth.
- Click the Browse button next to Private key file for authentication.
- Navigate to the private key file saved when you generated the SSH keys and click Open.
- From the main PuTTY screen click Open.
- You will now be connected to your server command line.
- Explain how SSH is different from the Bastion service
Top comments (0)