Configure Bastion session recording
This article helps you configure Bastion session recording. When the Azure Bastion Session recording feature is enabled, you can record the graphical sessions for connections made to virtual machines (RDP and SSH) via the bastion host. After the session is closed or disconnected, recorded sessions are stored in a blob container within your storage account (via SAS URL). When a session is disconnected, you can access and view your recorded sessions in the Azure portal on the Session Recording page. Session recording requires the Bastion Premium SKU.
Before you begin
The following sections outline considerations, limitations, and prerequisites for Bastion session recording.
Considerations and limitations
- The Premium SKU is required for this feature.
- Session recording isn't available via native client at this time.
- Session recording supports one container/storage account at a time.
- When session recording is enabled on a bastion host, Bastion records ALL sessions that go through the recording-enabled bastion host.
Prerequisites
- Azure Bastion is deployed to your virtual network. See Tutorial - Deploy Bastion using specified settings for steps.
- Bastion must be configured to use Premium SKU for this feature. You can update to the Premium SKU from a lower SKU when you configure the session recording feature. To check your SKU and upgrade, if necessary, see View or upgrade a SKU.
- The virtual machine that you connect to must either be deployed to the virtual network that contains the bastion host, or to a virtual network that is directly peered to the Bastion virtual network.
Enable session recording
You can enable session recording when you create a new bastion host resource, or you can configure it later, after deploying Bastion.
Steps for new Bastion deployments
When you manually configure and deploy a bastion host, you can specify the SKU tier and features at the time of deployment. For comprehensive steps to deploy Bastion, see Deploy Bastion by using specified settings.
- In the Azure portal, select Create a Resource.
- Search for Azure Bastion and select Create.
- Fill in the values using manual settings, being sure to select the Premium SKU.
- In the Advanced tab, select Session Recording to enable the session recording feature.
- Review your details and select Create. Bastion immediately begins creating your bastion host. This process takes about 10 minutes to complete.
Steps for existing Bastion deployments
If you've already deployed Bastion, use the following steps to enable session recording.
- In the Azure portal, go to your Bastion resource.
- On your Bastion page, in the left pane, select Configuration.
- On the Configuration page, for Tier, select Premium if it isn't already selected. This feature requires the Premium SKU.
- Select Session Recording (Preview) from the listed features.
- Select Apply. Bastion immediately begins updating the settings for your bastion host. Updates take about 10 minutes.
Configure storage account container
In this section, you set up and specify the container for session recordings.
Create a storage account in your resource group. For steps, see Create a storage account and Grant limited access to Azure Storage resources using shared access signatures (SAS).
Within the storage account, create a Container. This is the container you'll use to store your Bastion session recordings. We recommend that you create an exclusive container for session recordings. For steps, see Create a container.
On the page for your storage account, in the left pane, expand Settings. Select Resource sharing (CORS).
Create a new policy under Blob service and save your changes at the top of the page.
Name | Value |
---|---|
Allowed origins | https:// followed by the full DNS name of your bastion, starting with bst- . Keep in mind, these values are case-sensitive. |
Allowed methods | GET |
Allowed headers | * |
Exposed headers | * |
Max age | 86400 |
Add or update the SAS URL
To configure session recordings, you must add a SAS URL to your Bastion Session recordings configuration. In this section, you generate the Blob SAS URL from your container, then upload it to your bastion host.
The following steps help you configure the required settings directly on the Generate SAS page. However, you can optionally configure some of the settings by creating a stored access policy. You can then link the stored access policy to the SAS token on the Generate SAS page. If you want to create a stored access policy, either select Permissions and Start/expiry date and time in the access policy, or on the Generate SAS page.
- On your storage account page, go to Data storage -> Containers.
- Locate the container you created to store Bastion session recordings, then click the 3 dots (ellipses) to the right of your container and select Generate SAS from the dropdown list.
- On the Generate SAS page, for Permissions, select READ, CREATE, WRITE, LIST.
- For Start and expiry date/time, use the following recommendations:
- Set Start time to be at least 15 minutes before the present time.
- Set Expiry time to be long into the future.
- Under Allowed Protocols, select HTTPS only.
- Click Generate SAS token and URL. You'll see the Blob SAS token and Blob SAS URL generated at the bottom of the page.
- Copy the Blob SAS URL.
- Go to your bastion host. In the left pane, select Session recordings.
- At the top of the page, select Add or update SAS URL. Paste your SAS URL, then click Upload.
View a recording
Sessions are automatically recorded when Session Recording is enabled on the bastion host. You can view recordings in the Azure portal via an integrated web player.
- In the Azure portal, go to your Bastion host.
- In the left pane, under Settings, select Session recordings.
- The SAS URL should already be configured (earlier in this exercise). However, if your SAS URL expired, or you need to add the SAS URL, use the previous steps to acquire and upload the Blob SAS URL.
- Select the VM and recording link that you want to view, then select View recording.
Next steps
View the Bastion FAQ for additional information about Bastion.