Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Load Testing #51

Open
mbraekman opened this issue Mar 21, 2022 · 0 comments
Open

Azure Load Testing #51

mbraekman opened this issue Mar 21, 2022 · 0 comments

Comments

@mbraekman
Copy link
Owner

mbraekman commented Mar 21, 2022

Describe the documentation you'd like to see
Using Azure Load Testing service to execute performance tests on your API.

Additional context
How to set up Azure Load Testing service
How to create a test plan
How to set up a load test in Azure
How to run a load test
How to validate the results

How to set up Azure Load Testing service

Step 1: register resource provider within your subscription
Step 2: use bicep to create the service

// This requires the 'Microsoft.LoadTestService'-provider to be registered on the subscription
resource loadTesting 'Microsoft.LoadTestService/loadTests@2021-12-01-preview' = {
  name: naming.loadTesting
  location: global.secondaryLocation
  identity: {
    type: 'SystemAssigned'
  }
}

Step 3: Create the required Role Assignments on the Load Test Service for the AD Group requiring access

var loadTestContributorRoleId = '${subscription().id}/providers/Microsoft.Authorization/roleDefinitions/749a398d-560b-491b-bb21-08924219302e'

// Create Role Assignment on the Load Test Service for AD Group.
resource adGroup_LoadTest_roleAssignment_Contributor 'Microsoft.Authorization/roleAssignments@2020-08-01-preview' = {
  name: guid(global.developerGroupId)
  scope: loadTesting
  properties: {
    principalId: global.developerGroupId
    roleDefinitionId: loadTestContributorRoleId
  }
}
resource sp_LoadTest_roleAssignment_Contributor 'Microsoft.Authorization/roleAssignments@2020-08-01-preview' = {
  name: guid(global.azureServicePrincipalObjectId)
  scope: loadTesting
  properties: {
    principalId: global.azureServicePrincipalObjectId
    roleDefinitionId: loadTestContributorRoleId
  }
}

Step 4: Create an Access Policy in KeyVault for any potential secrets you will need in the test plans.

// Key Vault Access Policies
resource appService_keyVault_accessPolicy 'Microsoft.KeyVault/vaults/accessPolicies@2021-06-01-preview' = {
  name: '${naming.keyVault}/add'
  properties: {
    accessPolicies:  [
      {
        objectId: reference(resourceId('Microsoft.LoadTestService/loadTests', naming.loadTesting), '2021-12-01-preview', 'Full').identity.principalId
        tenantId: subscription().tenantId
        permissions: {
          secrets: [
            'get'
            'list'
          ]
        }
      }
    ]
  }
}

How to create a test plan

In order to be able to create a new test plan, you will have to download Apache JMeter, which can be found here.
This open-source application allows you to create test plans to validate the functional behavior but also measure performance.

How to set up a load test in Azure

Currently not possible yet by using Bicep, so below are the manual steps:
....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant