azurermMssqlServerVulnerabilityAssessment
Manages the Vulnerability Assessment for a MS SQL Server.
-> NOTE Vulnerability Assessment is currently only available for MS SQL databases.
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 azurermSqlServerExample = new azurerm.sqlServer.SqlServer(
this,
"example_1",
{
administrator_login: "4dm1n157r470r",
administrator_login_password: "4-v3ry-53cr37-p455w0rd",
location: azurermResourceGroupExample.location,
name: "mysqlserver",
resource_group_name: azurermResourceGroupExample.name,
version: "12.0",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSqlServerExample.overrideLogicalId("example");
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
this,
"example_2",
{
account_replication_type: "GRS",
account_tier: "Standard",
location: azurermResourceGroupExample.location,
name: "accteststorageaccount",
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", {
container_access_type: "private",
name: "accteststoragecontainer",
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 azurermMssqlServerSecurityAlertPolicyExample =
new azurerm.mssqlServerSecurityAlertPolicy.MssqlServerSecurityAlertPolicy(
this,
"example_4",
{
resource_group_name: azurermResourceGroupExample.name,
server_name: azurermSqlServerExample.name,
state: "Enabled",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMssqlServerSecurityAlertPolicyExample.overrideLogicalId("example");
const azurermMssqlServerVulnerabilityAssessmentExample =
new azurerm.mssqlServerVulnerabilityAssessment.MssqlServerVulnerabilityAssessment(
this,
"example_5",
{
recurring_scans: [
{
email_subscription_admins: true,
emails: ["email@example1.com", "email@example2.com"],
enabled: true,
},
],
server_security_alert_policy_id:
azurermMssqlServerSecurityAlertPolicyExample.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.*/
azurermMssqlServerVulnerabilityAssessmentExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
serverSecurityAlertPolicyId
- (Required) The id of the security alert policy of the MS SQL Server. 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. IfstorageContainerSasKey
isn't specified,storageAccountAccessKey
is required.
-> NOTE The storageAccountAccessKey
only applies if the storage account is not behind a virtual network or a firewall.
storageContainerSasKey
- (Optional) A shared access signature (SAS Key) that has write access to the blob container specified instorageContainerPath
parameter. IfstorageAccountAccessKey
isn't specified,storageContainerSasKey
is required.
-> NOTE The storageContainerSasKey
only applies if the storage account is not behind a virtual network or a firewall.
recurringScans
- (Optional) The recurring scans settings. TherecurringScans
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 tofalse
.emailSubscriptionAdmins
- (Optional) Boolean flag which specifies if the schedule scan notification will be sent to the subscription administrators. Defaults tofalse
.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 MS SQL Server Vulnerability Assessment.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the MSSQL Server Vulnerability Assessment.update
- (Defaults to 30 minutes) Used when updating the MSSQL Server Vulnerability Assessment.read
- (Defaults to 5 minutes) Used when retrieving the MSSQL Server Vulnerability Assessment.delete
- (Defaults to 30 minutes) Used when deleting the MSSQL Server Vulnerability Assessment.
Import
MS SQL Server Vulnerability Assessment can be imported using the resourceId
, e.g.