Skip to content

azurermSynapseSqlPoolVulnerabilityAssessment

Manages the Vulnerability Assessment for a Synapse SQL Pool.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermStorageAccountAuditLogs =
  new azurerm.storageAccount.StorageAccount(this, "audit_logs", {
    account_replication_type: "LRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "examplesa",
    resource_group_name: azurermResourceGroupExample.name,
  });
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_2",
  {
    account_kind: "StorageV2",
    account_replication_type: "LRS",
    account_tier: "Standard",
    is_hns_enabled: "true",
    location: azurermResourceGroupExample.location,
    name: "examplestorageacc",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermStorageContainerExample =
  new azurerm.storageContainer.StorageContainer(this, "example_3", {
    name: "example",
    storage_account_name: azurermStorageAccountExample.name,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageContainerExample.overrideLogicalId("example");
const azurermStorageDataLakeGen2FilesystemExample =
  new azurerm.storageDataLakeGen2Filesystem.StorageDataLakeGen2Filesystem(
    this,
    "example_4",
    {
      name: "example",
      storage_account_id: azurermStorageAccountExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageDataLakeGen2FilesystemExample.overrideLogicalId("example");
const azurermSynapseWorkspaceExample =
  new azurerm.synapseWorkspace.SynapseWorkspace(this, "example_5", {
    aad_admin: [
      {
        login: "AzureAD Admin",
        object_id: "00000000-0000-0000-0000-000000000000",
        tenant_id: "00000000-0000-0000-0000-000000000000",
      },
    ],
    identity: [
      {
        type: "SystemAssigned",
      },
    ],
    location: azurermResourceGroupExample.location,
    name: "example",
    resource_group_name: azurermResourceGroupExample.name,
    sql_administrator_login: "sqladminuser",
    sql_administrator_login_password: "H@Sh1CoR3!",
    storage_data_lake_gen2_filesystem_id:
      azurermStorageDataLakeGen2FilesystemExample.id,
    tags: {
      Env: "production",
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSynapseWorkspaceExample.overrideLogicalId("example");
const azurermSynapseSqlPoolExample = new azurerm.synapseSqlPool.SynapseSqlPool(
  this,
  "example_6",
  {
    create_mode: "Default",
    name: "examplesqlpool",
    sku_name: "DW100c",
    synapse_workspace_id: azurermSynapseWorkspaceExample.id,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSynapseSqlPoolExample.overrideLogicalId("example");
const azurermSynapseSqlPoolSecurityAlertPolicyExample =
  new azurerm.synapseSqlPoolSecurityAlertPolicy.SynapseSqlPoolSecurityAlertPolicy(
    this,
    "example_7",
    {
      disabled_alerts: ["Sql_Injection", "Data_Exfiltration"],
      policy_state: "Enabled",
      retention_days: 20,
      sql_pool_id: azurermSynapseSqlPoolExample.id,
      storage_account_access_key:
        azurermStorageAccountAuditLogs.primaryAccessKey,
      storage_endpoint: azurermStorageAccountAuditLogs.primaryBlobEndpoint,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSynapseSqlPoolSecurityAlertPolicyExample.overrideLogicalId("example");
const azurermSynapseSqlPoolVulnerabilityAssessmentExample =
  new azurerm.synapseSqlPoolVulnerabilityAssessment.SynapseSqlPoolVulnerabilityAssessment(
    this,
    "example_8",
    {
      recurring_scans: [
        {
          email_subscription_admins_enabled: true,
          emails: ["email@example1.com", "email@example2.com"],
          enabled: true,
        },
      ],
      sql_pool_security_alert_policy_id:
        azurermSynapseSqlPoolSecurityAlertPolicyExample.id,
      storage_account_access_key: azurermStorageAccountExample.primaryAccessKey,
      storage_container_path: `\${${azurermStorageAccountExample.primaryBlobEndpoint}}\${${azurermStorageContainerExample.name}}/`,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSynapseSqlPoolVulnerabilityAssessmentExample.overrideLogicalId(
  "example"
);

Argument Reference

The following arguments are supported:

  • sqlPoolSecurityAlertPolicyId - (Required) The ID of the security alert policy of the Synapse SQL Pool. Changing this forces a new resource to be created.

  • storageContainerPath - (Required) A blob storage container path to hold the scan results (e.g. https://example.blob.core.windows.net/VaScans/).

  • storageAccountAccessKey - (Optional) Specifies the identifier key of the storage account for vulnerability assessment scan results. If storageContainerSasKey isn't specified, storageAccountAccessKey is required.

  • storageContainerSasKey - (Optional) A shared access signature (SAS Key) that has write access to the blob container specified in storageContainerPath parameter. If storageAccountAccessKey isn't specified, storageContainerSasKey is required.

  • recurringScans - (Optional) The recurring scans settings. The recurringScans block supports fields documented below.


The recurringScans block supports the following:

  • enabled - (Optional) Boolean flag which specifies if recurring scans is enabled or disabled. Defaults to false.
  • emailSubscriptionAdminsEnabled - (Optional) Boolean flag which specifies if the schedule scan notification will be sent to the subscription administrators. Defaults to false.
  • emails - (Optional) Specifies an array of email addresses to which the scan notification is sent.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Synapse SQL Pool Vulnerability Assessment.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Synapse SQL Pool Vulnerability Assessment.
  • update - (Defaults to 30 minutes) Used when updating the Synapse SQL Pool Vulnerability Assessment.
  • read - (Defaults to 5 minutes) Used when retrieving the Synapse SQL Pool Vulnerability Assessment.
  • delete - (Defaults to 30 minutes) Used when deleting the Synapse SQL Pool Vulnerability Assessment.

Import

Synapse SQL Pool Vulnerability Assessment can be imported using the resourceId, e.g.

terraform import azurerm_synapse_sql_pool_vulnerability_assessment.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Synapse/workspaces/workspace1/sqlPools/sqlPool1/vulnerabilityAssessments/default