K6: Support and examples for Azure AD (multi-tenant) authentication with k6 running as ACI containers

Created on 25 Apr 2019  路  5Comments  路  Source: loadimpact/k6

I'm currently evaluating replacing Visual Studio load testing projects with k6 on a large multi-tenant micro-services project, however I could not find examples on AzureAD and MSAL.js library authentication/integration and ACI hosting support.

  • Each of the tests would need to authenticate with different AzureAD instances and load test REST API endpoints.
  • Execute load tests continually (e.g for 24 hours+) in Azure DevOps pipelines, in a distributed manner (support launching k6 as Azure Container Instances or Azure DevOps agents and remove once load tests are complete?)

Links

https://docs.microsoft.com/en-au/azure/container-instances/
https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics
https://github.com/AzureAD/microsoft-authentication-library-for-js

docs enhancement help wanted js-compat

Most helpful comment

@MedAnd I investigated a little how it could be done.

Each of the tests would need to authenticate with different AzureAD instances.

I am not sure if MASL.js library will work in k6 because of the current limitations of JS libraries.

MASL.js looks to be a utility to interact with the Microsoft Identity Platform/Azure AD and I think you can create an HTTP request in your script to authenticate the user to perform the requests to your REST API endpoints.

According to Microsoft docs:

If you don't have yet a library for your language of choice, you might want to use the protocol directly

POST /{tenant}/oauth2/v2.0/token

Execute load tests continually (e.g for 24 hours+) in Azure DevOps pipelines, in a distributed in a distributed manner

The guide How to integrate your k6 load tests with Azure Pipelines is a good reference.

All 5 comments

@MedAnd I investigated a little how it could be done.

Each of the tests would need to authenticate with different AzureAD instances.

I am not sure if MASL.js library will work in k6 because of the current limitations of JS libraries.

MASL.js looks to be a utility to interact with the Microsoft Identity Platform/Azure AD and I think you can create an HTTP request in your script to authenticate the user to perform the requests to your REST API endpoints.

According to Microsoft docs:

If you don't have yet a library for your language of choice, you might want to use the protocol directly

POST /{tenant}/oauth2/v2.0/token

Execute load tests continually (e.g for 24 hours+) in Azure DevOps pipelines, in a distributed in a distributed manner

The guide How to integrate your k6 load tests with Azure Pipelines is a good reference.

@ppcano - appreciate the follow-up! We tested use of MSAL in a simple load test and as you noted MSAL.js is meant for interactive use, not automated login as is required for load testing.

I'm currently checking with the MS Azure AD team on the best way forward and will share an update here.

Hey there, @MedAnd !

Just wanted to follow up with you and see whether you actually got this working in the end? It seems like something that might benefit other k6 users as well.

Thank you in advance!

Best,
Simme

Howdy @simskij - almost forgot this request but a change of client meant I never implemented. Given it's almost been a year, maybe the team behind k6 have implemented Azure AD integration 馃檪 ?

Closing this then. Thanks for replying!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sniku picture sniku  路  3Comments

euclid1990 picture euclid1990  路  3Comments

sdhoward picture sdhoward  路  3Comments

caalle picture caalle  路  4Comments

kokokenada picture kokokenada  路  4Comments