Azure Resource Manager Plugin

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

Installation

  1. Copy the below line to dependencies section of the project build.gradle file

    Please make sure to use the same version for all VIVIDUS dependencies.
    Example 1. build.gradle
    implementation(group: 'org.vividus', name: 'vividus-plugin-azure-resource-manager', version: '0.6.12')
  2. If the project was imported to the IDE before adding new dependency, re-generate the configuration files for the used IDE and then refresh the project in the used IDE.

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`

Get information about Azure resource using Azure resource URL

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

When I get Azure resource with URL `$azureResourceUrl` and save it to $scopes variable `$variableName`
  • $azureResourceURL - It’s used to specify Azure resource uniquely. For example:

    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

    or

    https://api.loganalytics.io/v1/workspaces/00000000-0000-0000-0000-000000000000/query?query=Syslog
  • $scopes - The comma-separated set of the variables scopes.

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

Example 3. Query Log Analytics
When I get Azure resource with URL `https://api.loganalytics.io/v1/workspaces/00000000-0000-0000-0000-000000000000/query?query=Syslog` and save it to scenario variable `logAnalyticsQueryResult`
Example 4. Get secret from Key Vault
When I get Azure resource with URL `https://KEY-VAULT-NAME.vault.azure.net/secrets/SECRET-NAME?api-version=7.3` and save it to scenario variable `keyVaultSecret`

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 5. 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 6. 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 7. 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`