In this demo, we'll attempt to load test an private API endpoint using the Azure Load Testing Preview. The private API endpoint in question is only accessible from within an Azure virtual network (VNET). We'll demonstrate Azure Load Testing service's capability to generate load from within a virtual network (using VNET resource injection).
Please execute the steps outlined in the deployment instructions to provision the infrastructure in your own Azure subscription.
Warning To deploy the additional resources for this walkthrough ensure you have set the GitHub Action's variable
DEPLOYPRIVATEENDPOINTS
totrue
. If you're using Azure DevOps Pipeline, then please ensure that the variableDEPLOYPRIVATEENDPOINTS
is set totrue
in thecontosotraders-cloudtesting-variable-group
variable group.
Specifically, here's what happens behind the scenes:
-
An Azure virtual network (VNET) is created with three subnets:
- A subnet for Azure Container Apps to deploy its infrastructure as well as the application's API private endpoints.
- A subnet for Azure Load Testing to inject its resources.
- A subnet for Azure VMs (jumpboxes) to access the application's private endpoints (for visual verification purposes).
-
An Azure Container Apps instance is deployed to host the application's API endpoints. The API endpoints are configured to be private endpoints, and the ingress controller only allows internal VNET traffic (i.e. endpoint is only accessible from within the VNET).
-
A private DNS zone (e.g.
eastus.azurecontainerapps.io
) is created to resolve the private endpoints' DNS names. This private DNS zone is associated with the VNET's subnet ACA. We add the necessary A records to link the endpoint FQDN to the ACA's private IP address. -
A jumpbox VM is deployed to the VNET's VM subnet. This VM will be used in this demo to access the application's private endpoints.
-
In the Azure portal, you can navigate to the
contoso-traders-intcarts{SUFFIX}
Azure Container App in thecontoso-traders-rg
resource group. This is the application that hosts theCarts API
. Note that this application is only accessible from within the VNET. -
You can get the URL of the
Carts API
by as shown below. -
In a separate browser tab, enter the following url in the address bar to load the API's swagger page:
<ACA url>/swagger/index.html
. You'll notice that the API's endpoints are not reachable via the public internet. -
To access the API's endpoints, you'll need to access the API from within the VNET. You can RDP into the
jumpboxvm
VM. This is a jumpbox VM located in the same resource groupcontoso-traders-rg
. From this RDP session, you can access the API's swagger page:<ACA url>/swagger/index.html
-
The specific API that we'll be using for is the
Carts API
'sGET <ACA url>/v1/ShoppingCart/loadtest
endpoint. Please note down this endpoint for later use.
-
In the Azure portal, navigate to the Azure Load Testing instance (in the
contoso-traders-rg
resource group) that we created in the previous demo. -
Now click on
Configure
>Tests
. -
Navigate to the
Parameters
tab in the Edit Test blade. Modify thedomain
value to point to theCarts API
's private endpoint. You can use the<ACA url>
you noted down earlier (note: please remove thehttps://
prefix). -
Navigate to the
Load
tab. ChangeConfigure test traffic mode
toprivate
. Also, specify the VNET and subnet details:contoso-traders-vnet{SUFFIX}
andsubnet-loadtest
respectively. -
Click apply to save the changes.
-
Now, click
Run
to start the load test against the private endpoint. -
Behind the scenes, the Azure load testing service will inject the testing infrastructure into the specified VNET. The load test will successfully run to completion after that.
In this demo, we saw how Azure Load Testing can be used to generate load from within a virtual network to test private/restricted API endpoints.
- Troubleshooting private endpoints
- Test private endpoints by deploying Azure Load Testing in an Azure virtual network
- Scenarios for deploying Azure Load Testing in a virtual network
- Blog Post: Load test endpoints with access restrictions using Azure Load Testing
- Blog Post: Load test private endpoints deployed in another Azure region or subscription