Skip to content

Latest commit

 

History

History
147 lines (98 loc) · 6.3 KB

functions.md

File metadata and controls

147 lines (98 loc) · 6.3 KB

Functions

How to install

Download jmeter-plugins-functions-azure-?.?.?.jar file from latest release and put it into lib/ext directory of JMeter (ex. /usr/local/jmeter/lib/ext), then restart JMeter.

__AzAdAccessToken

This function gets the access token for the Azure AD application from the Azure AD token endpoint with a password flow.

Parameters

Attribute Description Required
Azure AD tenant ID Tenant ID of Azure AD. Yes
Grant type Only "password" can be used. Yes
Application (Client) ID The client identifier of Azure AD application. Yes
Client secret Client secret of Azure AD application. Yes
Username Access user account name. (ex. name@example.onmicrosoft.com) Yes
Password Access user password. Yes
Scope Acess Token Scope. No
Resource App ID URI of the receiving web service.
Valid only for Azure AD version 1.
If you omit this, the "Application ID" value is applied.
No
Azure AD version v2.0 or empty string. No
Azure AD endpoint URI Specify when using an Azure AD endpoint, such as Azure Government or Azure China.
(ex. login.partner.microsoftonline.cn)
Or you can use some abbreviations. (us / cn / de)
The default is Azure global endpoint.
* But I haven't been able to test with Azure Govement, Azure China or Azure Germany, because I don't have subscriptions there. If you use these Azure, I would be happy to have you report your results to here.
No
Name of variable The name of the variable to set. No

Examples

${__AzAdAccessToken(example.onmicrosoft.com,password,01234567-89ab-cdef-0123-456789abcdef,TX2********pJ-,[email protected],<PASSWORD>)}

returns eyJ**********yJ9.eyJ**********CJ9.px9**********S5O

Sample files

Examples of usage scenarios

  • Creating Authorization header for requesting to the Azure App Service with Easy Auth configured.

Tutorial

__AzAppServiceAuthenticationToken

AzAppServiceAuthenticationToken gets the authentication token that should be specified in X-ZUMO-AUTH when accessing the Easy Auth-rated Azure App Service.

Parameters

Attribute Description Required
Azure App Service hostname Your Azure App Service hosname (ex. example.azurewebsites.net, www.example.com) Yes
Provider Authentication provider. (aad, google, facebook, twitter) Yes
access_token or id_token Access token (aad, facebook, twitter) or id_token (google) obtained from the provider. Yes
twitter access_token_secret In the case of twitter, set Access token secret. No
Name of variable The name of the variable to set. No

Examples

${__AzAppServiceAuthenticationToken(example.azurewebsites.net,facebook,EAA****WQM)}
${__AzAppServiceAuthenticationToken(www.example.com,twitter,423****o3G,JmG****2V1)}

returns eyJ********lZw

Sample files

Examples of usage scenarios

  • Creating X-ZUMO-AUTH header for requesting to the Azrue App Service with Easy Auth configured.

__AzCosmosDbAuthZ

AzCosmosDbAuthZ frunction returns a string to be specified in the Authorization header for accessing Cosmos DB.

Parameters

Attribute Description Required
Cosmosdb Key Cosmos DB master key Yes
x-ms-date header variable name Name of variable in which to store for x-ms-date header. Yes
HTTP Request method The string is the HTTP verb, such as GET, POST, or PUT. Yes
ResourceType Type of resource that the request is for, Eg. "dbs", "colls", "docs". Yes
ResourceLink Identity property of the resource that the request is directed at. ResourceLink must maintain its case for the ID of the resource. Example, for a collection it looks like: "dbs/MyDatabase/colls/MyCollection". Yes
TokenVersion The version of the token.(optinal) currently 1.0. No

Examples

${__AzCosmosDbAuthZ(dxN************79w==,headers.x-ms-date,GET,docs,dbs/SampleDB/colls/Persons)}

returns type%3Dmaster%26ver%3D1.0%26sig%3DEeW************sW4%3D
headers.x-ms-date=Mon, 07 Sep 2020 00:34:57 GMT

Sample files

Tutorial

__hmac

The hmac function returns a HMAC in the specific hash algorithm with the key and variable name.

Parameters

Attribute Description Required
Algorithm The algorithm to be used to hash For possible algorithms See Mac in StandardNames
  • HmacMD5
  • HmacSHA1
  • HmacSHA224
  • HmacSHA256
  • HmacSHA384
  • HmacSHA512
Yes
String to HMAC The String that will be HMAC Yes
Private key Base64 encoded private key to be used for hashing Yes
Name of variable The name of the variable to set No

Examples

${__hmac(HmacSHA256,Hello World,SGVsbG8gQXp1cmUh,)}

returns qLGOpn6DRZMiXdjA2RLctf5Ya0ZPtgGP97ZkBkCW3xg=

Sample files

Examples of usage scenarios

  • Creating Authorization header for requesting to the CosmosDB via REST API