Azure Resource Manager Plugin

The plugin provides the ability to collect information about Azure resources, also to create, update and delete them.

Installation

Example 1. build.gradle
implementation(group: 'org.vividus', name: 'vividus-plugin-azure-resource-manager', version: '0.4.9-SNAPSHOT')

Resource management

Configuration

Authentication

The authentication process relies on the configuration of the environment variables.

See the official "Azure identity" guide to get more details on what types of authentication could be used.

Azure environment selection

Azure environment could be optionally specified using global property azure.environment (sets the environment for all Azure plugins). The default value is AZURE.

The supported environments are only:

  • AZURE

  • AZURE_CHINA

  • AZURE_GERMANY

  • AZURE_US_GOVERNMENT

Azure subscription selection

Azure subscription must be configured via AZURE_SUBSCRIPTION_ID environment variable.

Steps

Get information about Azure resource

Gets the info about the specified Azure resource using the declared Azure API version and saves it to a variable. For more information, see the Azure REST API reference.

When I get Azure resource with identifier `$azureResourceIdentifier` using API version `$apiVersion` and save it to $scopes variable `$variableName`
  • $azureResourceIdentifier - This is a VIVIDUS-only term. It’s used to specify Azure resource uniquely. From the technical perspective it’s a part of Azure resource REST API URL path. For example, if the full Azure resource URL is

    https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault?api-version=2021-10-01

    then the resource identifier will be

    resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault
  • $apiVersion - Azure resource provider API version. Note API versions may vary depending on the resource type.

  • $scopes - The comma-separated set of the variables scopes.

  • $variableName - The variable name to store the Azure resource info.

Example 2. Retrieve the Key Vault properties
When I get Azure resource with identifier `resourceGroups/TEST-RG/providers/Microsoft.KeyVault/vaults/KEY-VAULT-NAME` using API version `2021-10-01` and save it to scenario variable `key-vault-properties`

Create/Update Azure resource

Creates (if resource doesn’t exist) or updates the specified Azure resource using the declared Azure API version. For more information, see the Azure REST API reference.

When I configure Azure resource with identifier `$azureResourceIdentifier` and body `$azureResourceBody` using API version `$apiVersion`
  • $azureResourceIdentifier - This is a VIVIDUS-only term. It’s used to specify Azure resource uniquely. From the technical perspective it’s a part of Azure resource REST API URL path. For example, if the full Azure resource URL is

    https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault?api-version=2021-10-01

    then the resource identifier will be

    resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault
  • $azureResourceBody - The Azure resource configuration in JSON format.

  • $apiVersion - Azure resource provider API version. Note API versions may vary depending on the resource type.

Example 3. Create linked service in Azure DataFactory
When I configure Azure resource with identifier `resourceGroups/TEST-RG/providers/Microsoft.DataFactory/factories/TEST-ADF/linkedservices/test-datalake` and body `
{
    "properties": {
        "annotations": [],
        "type": "AzureBlobFS",
        "typeProperties": {
            "url": "https://storageaccount.dfs.core.windows.net/"
        }
    }
}
` using API version `2018-06-01`

Execute Azure operation

Executes the specified Azure operation using the declared Azure API version and saves the result to a variable. For more information, see the Azure REST API reference.

When I execute Azure operation with identifier `$azureOperationIdentifier` using API version `$apiVersion` and body `$azureOperationBody` and save result to $scopes variable `$variableName`
  • $azureOperationIdentifier - This is a VIVIDUS-only term. It’s used to specify Azure operation uniquely. From the technical perspective it’s a part of Azure operation REST API URL path. For example, if the full Azure operation URL is

    https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/checkNameAvailability?api-version=2021-10-01

    then the operation identifier will be

    providers/Microsoft.KeyVault/checkNameAvailability
  • $apiVersion - Azure resource provider API version. Note API versions may vary depending on the resource type.

  • $azureOperationBody - The Azure operation definition in JSON format.

  • $scopes - The comma-separated set of the variables scopes.

  • $variableName - The variable name to store the result of Azure operation execution.

Example 4. Check Key Vault name availability
When I execute Azure operation with identifier `providers/Microsoft.KeyVault/checkNameAvailability` using API version `2021-10-01` and body `
{
  "name": "my-super-vault",
  "type": "Microsoft.KeyVault/vaults"
}
` and save result to scenario variable `keyVaultNameAvailabilityCheckResult`

Delete Azure resource

Deletes the specified Azure resource using the declared Azure API version. For more information, see the Azure REST API reference.

When I delete Azure resource with identifier `$azureResourceIdentifier` using API version `$apiVersion`
  • $azureResourceIdentifier - This is a VIVIDUS-only term. It’s used to specify Azure resource uniquely. From the technical perspective it’s a part of Azure resource REST API URL path. For example, if the full Azure resource URL is

    https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault?api-version=2021-10-01

    then the resource identifier will be

    resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault
  • $apiVersion - Azure resource provider API version. Note API versions may vary depending on the resource type.

Example 5. Delete linked service from Azure DataFactory
When I delete Azure resource with identifier `resourceGroups/TEST-RG/providers/Microsoft.DataFactory/factories/TEST-ADF/linkedservices/test-datalake` using API version `2018-06-01`