In our last post we discussed the new feature Virtual Network Service Endpoint.
In this post we’re going to show how to use that feature.
We’re going to use it on a storage account.
We won’t go through the micro steps of setting up each services but we’ll focus on the Service Endpoint configuration.
As usual for demo / feature trial, let’s create a Resource Group for this so we can wipe it out at the end.
Let’s create a storage account in the resource group we’ve just created.
Let’s create a blob container named test. Let’s configure the blob container to have a public access level of Blob (i.e. anonymous read access for blobs only).
Let’s create a text file with the proverbial Hello World sentence so we can recognize it. Let’s name that file A.txt in it and copy it in the blob container.
We should be able to access the file via its public URL. For instance, given a storage account named vplsto we can find the URL by browsing the blobs.
Then selecting the container we can select the blob.
We should be able to open it in a browser.
Let’s create a Virtual Machine within the same resource group.
Here we’re going to use a Linux distribution in order to use the CURL command line later on but obviously something quite similar could be done with a Windows Server.
Once the deployment is done, let’s select the Virtual Network.
Let’s select the Subnet tab and then the subnet where we deployed the VM (in our case the subnet is names VMs).
At the bottom of the page, let’s select the Services drop down under Service Endpoints section. Let’s pick Microsoft.Storage.
Let’s hit save.
Separation of concerns
This is the Virtual Network configuration part we had to do. Next we’ll need to tell the storage account to accept connections only from our subnet.
By design the configuration is split between two areas: the Virtual Network and the PaaS Service (Storage in our case).
The aim of this design is to have potentially two individuals with two different permission sets configuring the services. The network admin configures the Virtual Network while the DBA would configure the database, the storage admin would configure the storage account, etc. .
Configuring Storage Account
In the Storage Account, main screen, let’s select Firewalls and virtual networks.
From there, let’s select the Selected Networks radio button.
Then let’s click on Add existing virtual network and select the VNET & subnet where the VM was deployed.
Let’s leave the Exceptions without changing it.
Let’s hit save.
If we refresh our web page pointing to the blob we should have an Authorization error page.
This is because our desktop computer isn’t on the VNET we configured.
Let’s SSH to the VM and try the following command line:
(replacing the URL by the blob URL we captured previously).
This should return us our Hello World. This is because the VM is within the subnet we configured within the storage account.
We’ve done a simple implementation of Azure Virtual Network Service Endpoints.
It is worth nothing that filtering is done at the subnet level. It is therefore important to design our Virtual Network with the right level of granularity for the subnets.