Skip to main content

Terraform and Script Runner for Azure Resource Manager

Integrate with Azure Resource Manager to collect evidence from your Azure cloud systems

Written by Micah Spieler
Updated today

With the Azure Resource Manager (RM) integration, you can collect evidence of your Azure configurations directly from your cloud infrastructure. This integration supports two collection methods — Terraform and Script Runner — so you can choose the approach that best fits what you're trying to collect. Both methods use the same authentication setup and support automated collection.

Types of evidence you might collect

There are a lot of different types of evidence you can collect from Azure Resource Manager (AzureRM), including:

  • Storage Blob data

  • Subscription information

  • Azure database information

  • Data about Azure VPN gateways

  • Data about an Azure Firewall

The Terraform method gives you the broadest flexibility, limited only by the data sources supported by Terraform's AzureRM provider. The Script Runner method makes it easy to collect common evidence types without writing any code.

Important note: You do not need to use Terraform in your tech stack in order to use this integration.

Setting up the integration

To configure this integration, you (or someone in your organization) will need access and permissions to configure a new Azure Service Principal.

Get started by navigating to the Integration Manager in Strike Graph and opening the Azure Resource Manager integration. Note: if you do not see this integration listed, it may not be available for your organization or role yet; reach out to customer success to inquire.

Click the "+ Connect" button to begin configuring a new connection.

Setting up your Azure Service Principal

We authenticate to Azure Resource Manager using a Service Principal with a Client Secret. A service principal is a security identity used to access specific Azure data sources — think of it as a login identity (similar to a username/password) that has access to resources in a particular Azure tenant. Roles can be assigned to a service principal, such as "Reader" access to a specific Azure subscription or management group.

Each service principal has a Client ID (appID), Client Secret (password), and Tenant ID. For more information about service principals, see Microsoft's documentation.

In your Azure Portal, configure a new service principal that Strike Graph can use to read data from your Azure environments. Alternatively, you can create a service principal using the Azure CLI. Instructions for either approach can be found here.

For proper security, only assign the "Reader" role to your service principal — that is all Strike Graph requires for evidence collection. More information about Azure roles can be found here.

Subscription vs. Management Group scope

When assigning the Reader role to your service principal, you have two options:

Subscription-level scope (default): Assign Reader to a specific subscription. This is the most common approach when collecting evidence from a single Azure subscription.

Management Group-level scope: If your organization uses Azure Management Groups, you can assign the Reader role at the Management Group level instead. This gives your service principal read access to all subscriptions within that group without needing separate credentials per subscription. To do this, navigate to your Management Group in the Azure Portal, go to Access control (IAM), and add your service principal as a Reader.

Note that Strike Graph integrations are keyed on a unique combination of client_id, tenant_id, and subscription_id, so you will configure one connection per subscription you intend to collect evidence from, even if your service principal has management group-level access.

Entering your credentials in Strike Graph

Back in the Strike Graph interface, enter your service principal credentials into the matching fields:

  • Display Name: a descriptive label to help identify this connection from other Azure integrations that may be configured

  • Azure Subscription ID: the subscription_id to which you gave your service principal "Reader" access

  • Azure Tenant ID: your service principal tenant

  • Azure Client ID: your service principal appId

  • Azure Client Secret: your service principal password

Click "Save" to finalize the configuration.

You can configure as many connections as needed to manage different subscriptions or permission scopes. Everyone with access to your GRC organization will be able to use any configured connections during evidence collection.

Collecting evidence

Once your integration is configured, navigate to the evidence item you want to collect for and click Attach Directly or Automated Collection. Select your Terraform & Scripts - Azure Resource Manager integration from the list of available integrations.

The evidence collection form has two tabs: Terraform and Scripts. Choose the method that works best for your needs.

Using Script Runner

The Scripts tab lets you collect evidence using Strike Graph's library of pre-built compliance collection scripts. No code required — just search, preview, and run.

  1. Select the Scripts tab.

  2. Use the search box to find a relevant script. The search is pre-populated with your evidence item's name as a starting point, but you can adjust as needed.

  3. Browse the results. Each script card displays the script name, category, a short description, and the Azure services it targets.

  4. Optionally, click Preview on any script card to review its full details and source code before running it.

  5. Click Run to execute the collection.

Strike Graph will run the script and attach the results to your evidence item. A loading indicator will appear while the script runs — this may take a moment to complete.

Once finished, the modal will close and the collected data will appear as an attachment.

Using Terraform Data Blocks

The Terraform tab lets you write your own HCL data blocks to collect from specific AzureRM data sources. This approach gives you the most flexibility and is well suited for evidence types that aren't covered by the available scripts.

Terraform integrations use "data blocks" to define what data to collect. More information about data blocks and local values can be found on the Terraform overview page. A full list of supported data sources is available at the bottom of this page and on the Terraform AzureRM provider page.

Step 1: Define the data block. Data blocks follow a typical pattern:

  • data_source — defines which AzureRM resource to read from. Supports any resource with a data source available from Terraform's AzureRM provider (see the list below).

  • temp_name — a temporary name you define to refer to this data block during execution. It's used in the output filename, so choose something recognizable. Names are limited to alphanumeric characters and do not allow spaces.

  • query constraints / arguments — many data sources require specific arguments (like the name of the resource you're reading from), or allow you to constrain results with filter queries. These are written as key/value pairs. Refer to the specific data source requirements in the Terraform AzureRM provider documentation.

Step 2: Define the local values for the execution. This follows a typical pattern derived from the data block: data.data_source.temp_name (sometimes followed by a key, like "metadata").

Click "Attach" to run the collection. This may take a few minutes as we set up the data pipeline. Once finished, the modal will close and the collected data will appear as an attachment on your evidence item.

Advanced Mode for Terraform Data Blocks

The Terraform tab offers two input modes: Basic and Advanced. You can toggle between them at the top of the form.

Basic mode uses a structured form where you fill in individual fields for the data_source, temp_name, query constraints, and local values. This is the recommended starting point as it guides you through the correct data block structure and validates your inputs as you go.

Advanced mode replaces the structured form with a single freeform code editor, letting you write complete HCL configurations directly. This is useful when you need to define multiple data blocks in one collection, chain data sources together, or work with more complex query constraints than the basic form supports. Advanced mode validates that your configuration only uses data blocks — resource, provider, module, and terraform blocks are not permitted.

If Security Assistant (described below) generates code for you, it will automatically switch the form to Advanced mode and populate the editor with the result.

Using Security Assistant to generate Terraform code

If you're not sure which data source to use or how to structure your data block, Security Assistant can generate the Terraform configuration for you based on a plain-language description of what you want to collect.

To use it, click the "Use Security Assistant" button near the top of the Terraform tab. A prompt area will appear — describe the evidence you want to collect in plain language. For example:

"Database encryption settings for our Azure SQL servers"

Click Send. Security Assistant will think through the request and generate the appropriate Terraform data blocks for your Azure environment. Once complete, the form will automatically switch to Advanced mode with the generated code populated and ready to run. You can review the code before attaching, and use the Resubmit button to refine it further if needed.

Security Assistant is available as part of select plans. If you don't see the "Use Security Assistant" button in the Terraform tab, reach out to your Customer Success Manager to inquire about access.

Using Automated Collection

It is highly recommended that you configure your evidence with automated collection. With Automated Collection, Strike Graph can recollect evidence attachments from Azure Resource Manager a few days before expiration, keeping your evidence in an audit-ready state without manual intervention.

Automated Collection works with both the Scripts and Terraform collection methods. To configure it, follow the collection steps above after clicking the "Automated Collection" button on the evidence item's detail page. Additional information about Automated Collection is available here.

Removing the integration

You can remove the integration at any time. Removing an integration does not delete any files that were previously attached using it, but it will disrupt automated collection.

To remove:

  1. Go to the Integration Manager and click on the Terraform & Scripts - Azure Resource Manager card to access your integration configurations.

  2. Click the "Deactivate" button next to your configuration.

Note: You may have access to remove integrations for other users on your team.

If you are fully removing access between Strike Graph and your Azure system, you may also wish to delete the service principal from the Azure Portal. Before deleting, verify that you are not using it for other purposes.

Troubleshooting

For additional Terraform troubleshooting tips, click here.

Errors when setting up an integration

If you receive an error while setting up an integration, check for a specific error message at the top of the form. If one or more of your service principal fields are invalid, the message will indicate which field(s) to check. If you have multiple invalid fields, the error will update with each one as you correct and resubmit.

General formatting errors

If you receive a generic error like "Something went wrong" during evidence collection, it may be a formatting issue. Check that your temp_name is formatted correctly (no spaces, only alphanumeric characters) and that there are no unexpected characters in the data block or local values.

Check permissions

If you receive a permissions error, ensure that your service principal has been granted the "Reader" role for the subscription or management group you are trying to collect from.

Confirm the data_source requirements

Check that the resource you defined in the data_source is available from the AzureRM Terraform provider, and ensure you have included any required query constraints or arguments.

Confirm the local values

Confirm that the local values are formatted correctly. Typically, the local value should start with "data" and include the data_source and temp_name. Check that these values are consistent between the data block and local values.

Script Runner errors

If a script fails to execute, an error message will appear in the Scripts tab. Verify that your integration credentials are still valid and that your service principal has the appropriate Reader permissions for the resources the script is targeting. If the issue persists, contact our support team through the in-app messenger and include the name of the script to help with troubleshooting.

The long list of supported Azure Resource Manager data sources

The following list is a snapshot of supported data sources from the AzureRM Terraform provider. For up to date support and specific data source requirements, visit the Terraform documentation.

AAD B2C

  • azurerm_aadb2c_directory

API Management

  • azurerm_api_management

  • azurerm_api_management_api

  • azurerm_api_management_api_version_set

  • azurerm_api_management_gateway

  • azurerm_api_management_group

  • azurerm_api_management_product

  • azurerm_api_management_user

Active Directory Domain Services

  • azurerm_active_directory_domain_service

Advisor

  • azurerm_advisor_recommendations

App Configuration

  • azurerm_app_configuration

  • azurerm_app_configuration_key

  • azurerm_app_configuration_keys

App Service (Web Apps)

  • azurerm_app_service

  • azurerm_app_service_certificate

  • azurerm_app_service_certificate_order

  • azurerm_app_service_environment

  • azurerm_app_service_environment_v3

  • azurerm_app_service_plan

  • azurerm_function_app

  • azurerm_function_app_host_keys

  • azurerm_linux_function_app

  • azurerm_linux_web_app

  • azurerm_service_plan

  • azurerm_source_control_token

  • azurerm_windows_function_app

  • azurerm_windows_web_app

Application Insights

  • azurerm_application_insights

Attestation

  • azurerm_attestation

Authorization

  • azurerm_role_definition

  • azurerm_user_assigned_identity

Automation

  • azurerm_automation_account

  • azurerm_automation_variable_bool

  • azurerm_automation_variable_datetime

  • azurerm_automation_variable_int

  • azurerm_automation_variable_string

Azure Stack HCI

  • azurerm_client_config

  • azurerm_extended_locations

  • azurerm_resource_group

  • azurerm_resources

  • azurerm_subscription

  • azurerm_subscriptions

Batch

  • azurerm_batch_account

  • azurerm_batch_application

  • azurerm_batch_certificate

  • azurerm_batch_pool

Billing

  • azurerm_billing_enrollment_account_scope

  • azurerm_billing_mca_account_scope

  • azurerm_billing_mpa_account_scope

Blueprints

  • azurerm_blueprint_definition

  • azurerm_blueprint_published_version

Bot

  • azurerm_cdn_frontdoor_endpoint

  • azurerm_cdn_frontdoor_origin_group

  • azurerm_cdn_frontdoor_profile

  • azurerm_cdn_frontdoor_rule_set

  • azurerm_cdn_profile

Cognitive Services

  • azurerm_cognitive_account

Compute

  • azurerm_availability_set

  • azurerm_dedicated_host

  • azurerm_dedicated_host_group

  • azurerm_disk_access

  • azurerm_disk_encryption_set

  • azurerm_image

  • azurerm_images

  • azurerm_managed_disk

  • azurerm_platform_image

  • azurerm_proximity_placement_group

  • azurerm_shared_image

  • azurerm_shared_image_gallery

  • azurerm_shared_image_version

  • azurerm_shared_image_versions

  • azurerm_snapshot

  • azurerm_ssh_public_key

  • azurerm_virtual_machine

  • azurerm_virtual_machine_scale_set

Confidential Ledger

  • azurerm_confidential_ledger

Connections

  • azurerm_managed_api

Consumption

  • azurerm_consumption_budget_resource_group

  • azurerm_consumption_budget_subscription

Container

  • azurerm_container_group

  • azurerm_container_registry

  • azurerm_container_registry_scope_map

  • azurerm_container_registry_token

  • azurerm_kubernetes_cluster

  • azurerm_kubernetes_cluster_node_pool

  • azurerm_kubernetes_service_versions

CosmosDB (DocumentDB)

  • azurerm_cosmosdb_account

  • azurerm_cosmosdb_mongo_database

  • azurerm_cosmosdb_restorable_database_accounts

Cost Management

  • azurerm_dns_a_record

  • azurerm_dns_aaaa_record

  • azurerm_dns_caa_record

  • azurerm_dns_cname_record

  • azurerm_dns_mx_record

  • azurerm_dns_ns_record

  • azurerm_dns_ptr_record

  • azurerm_dns_soa_record

  • azurerm_dns_srv_record

  • azurerm_dns_txt_record

  • azurerm_dns_zone

Data Explorer

  • azurerm_kusto_cluster

  • azurerm_kusto_database

Data Factory

  • azurerm_data_factory

Data Share

  • azurerm_data_share

  • azurerm_data_share_account

  • azurerm_data_share_dataset_blob_storage

  • azurerm_data_share_dataset_data_lake_gen2

  • azurerm_data_share_dataset_kusto_cluster

  • azurerm_data_share_dataset_kusto_database

DataProtection

  • azurerm_data_protection_backup_vault

Database

  • azurerm_mariadb_server

  • azurerm_mssql_database

  • azurerm_mssql_elasticpool

  • azurerm_mssql_managed_instance

  • azurerm_mssql_server

  • azurerm_mysql_flexible_server

  • azurerm_mysql_server

  • azurerm_postgresql_flexible_server

  • azurerm_postgresql_server

  • azurerm_sql_database

  • azurerm_sql_managed_instance

  • azurerm_sql_server

Database Migration

  • azurerm_database_migration_project

  • azurerm_database_migration_service

Databricks

  • azurerm_databricks_workspace

  • azurerm_databricks_workspace_private_endpoint_connection

Dev Test

  • azurerm_dev_test_lab

  • azurerm_dev_test_virtual_network

Digital Twins

  • azurerm_digital_twins_instance

Elastic

  • azurerm_elastic_cloud_elasticsearch

HDInsight

  • azurerm_hdinsight_cluster

Healthcare

  • azurerm_healthcare_dicom

  • azurerm_healthcare_fhir_service

  • azurerm_healthcare_medtech_service

  • azurerm_healthcare_service

  • azurerm_healthcare_workspace

IoT Hub

  • azurerm_iothub

  • azurerm_iothub_dps

  • azurerm_iothub_dps_shared_access_policy

  • azurerm_iothub_shared_access_policy

Key Vault

  • azurerm_key_vault

  • azurerm_key_vault_access_policy

  • azurerm_key_vault_certificate

  • azurerm_key_vault_certificate_data

  • azurerm_key_vault_certificate_issuer

  • azurerm_key_vault_encrypted_value

  • azurerm_key_vault_key

  • azurerm_key_vault_managed_hardware_security_module

  • azurerm_key_vault_secret

  • azurerm_key_vault_secrets

Load Balancer

  • azurerm_lb

  • azurerm_lb_backend_address_pool

  • azurerm_lb_rule

Log Analytics

  • azurerm_log_analytics_workspace

Logic App

  • azurerm_logic_app_integration_account

  • azurerm_logic_app_standard

  • azurerm_logic_app_workflow

Machine Learning

  • azurerm_machine_learning_workspace

Maintenance

  • azurerm_maintenance_configuration

  • azurerm_public_maintenance_configurations

Managed Applications

  • azurerm_managed_application_definition

Management

  • azurerm_management_group

Maps

  • azurerm_maps_account

Messaging

  • azurerm_eventgrid_domain

  • azurerm_eventgrid_domain_topic

  • azurerm_eventgrid_system_topic

  • azurerm_eventgrid_topic

  • azurerm_eventhub

  • azurerm_eventhub_authorization_rule

  • azurerm_eventhub_cluster

  • azurerm_eventhub_consumer_group

  • azurerm_eventhub_namespace

  • azurerm_eventhub_namespace_authorization_rule

  • azurerm_notification_hub

  • azurerm_notification_hub_namespace

  • azurerm_servicebus_namespace

  • azurerm_servicebus_namespace_authorization_rule

  • azurerm_servicebus_queue

  • azurerm_servicebus_queue_authorization_rule

  • azurerm_servicebus_subscription

  • azurerm_servicebus_topic

  • azurerm_servicebus_topic_authorization_rule

  • azurerm_signalr_service

Mixed Reality

  • azurerm_spatial_anchors_account

Monitor

  • azurerm_monitor_action_group

  • azurerm_monitor_data_collection_endpoint

  • azurerm_monitor_diagnostic_categories

  • azurerm_monitor_log_profile

  • azurerm_monitor_scheduled_query_rules_alert

  • azurerm_monitor_scheduled_query_rules_log

NetApp

  • azurerm_netapp_account

  • azurerm_netapp_pool

  • azurerm_netapp_snapshot

  • azurerm_netapp_snapshot_policy

  • azurerm_netapp_volume

Network

  • azurerm_application_gateway

  • azurerm_application_security_group

  • azurerm_express_route_circuit

  • azurerm_firewall

  • azurerm_firewall_policy

  • azurerm_ip_group

  • azurerm_local_network_gateway

  • azurerm_nat_gateway

  • azurerm_network_ddos_protection_plan

  • azurerm_network_interface

  • azurerm_network_security_group

  • azurerm_network_service_tags

  • azurerm_network_watcher

  • azurerm_private_endpoint_connection

  • azurerm_private_link_service

  • azurerm_private_link_service_endpoint_connections

  • azurerm_public_ip

  • azurerm_public_ip_prefix

  • azurerm_public_ips

  • azurerm_route_filter

  • azurerm_route_table

  • azurerm_subnet

  • azurerm_traffic_manager_geographical_location

  • azurerm_traffic_manager_profile

  • azurerm_virtual_hub

  • azurerm_virtual_network

  • azurerm_virtual_network_gateway

  • azurerm_virtual_network_gateway_connection

  • azurerm_virtual_wan

  • azurerm_vpn_gateway

  • azurerm_web_application_firewall_policy

Policy

  • azurerm_policy_assignment

  • azurerm_policy_definition

  • azurerm_policy_set_definition

  • azurerm_policy_virtual_machine_configuration_assignment

Portal

  • azurerm_portal_dashboard

Private DNS

  • azurerm_private_dns_a_record

  • azurerm_private_dns_aaaa_record

  • azurerm_private_dns_cname_record

  • azurerm_private_dns_mx_record

  • azurerm_private_dns_ptr_record

  • azurerm_private_dns_soa_record

  • azurerm_private_dns_srv_record

  • azurerm_private_dns_txt_record

  • azurerm_private_dns_zone

Recovery Services

  • azurerm_backup_policy_file_share

  • azurerm_backup_policy_vm

  • azurerm_recovery_services_vault

  • azurerm_site_recovery_fabric

  • azurerm_site_recovery_protection_container

  • azurerm_site_recovery_replication_policy

Redis

  • azurerm_redis_cache

Redis Enterprise

  • azurerm_redis_enterprise_database

Search

  • azurerm_search_service

Sentinel

  • azurerm_sentinel_alert_rule

  • azurerm_sentinel_alert_rule_template

Spring Cloud

  • azurerm_spring_cloud_app

  • azurerm_spring_cloud_service

Storage

  • azurerm_storage_account

  • azurerm_storage_account_blob_container_sas

  • azurerm_storage_account_sas

  • azurerm_storage_blob

  • azurerm_storage_container

  • azurerm_storage_encryption_scope

  • azurerm_storage_management_policy

  • azurerm_storage_share

  • azurerm_storage_sync

  • azurerm_storage_sync_group

  • azurerm_storage_table_entity

Stream Analytics

  • azurerm_stream_analytics_job

Synapse

  • azurerm_synapse_workspace

Template

  • azurerm_management_group_template_deployment

  • azurerm_resource_group_template_deployment

  • azurerm_subscription_template_deployment

  • azurerm_template_spec_version

  • azurerm_tenant_template_deployment

VMware (AVS)

  • azurerm_vmware_private_cloud

Web PubSub

  • azurerm_web_pubsub

  • azurerm_web_pubsub_private_link_resource

Did this answer your question?