Skip to content

Commit

Permalink
Add example for Microsoft.Sql_servers_auditingSettings@2022-05-01-pre…
Browse files Browse the repository at this point in the history
…view (#759)
  • Loading branch information
neil-yechenwei authored Feb 12, 2025
1 parent 8f1734b commit c27391a
Showing 1 changed file with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}

provider "azapi" {
skip_provider_registration = false
}

variable "resource_name" {
type = string
default = "acctest0001"
}

variable "location" {
type = string
default = "eastus"
}

resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}

resource "azapi_resource" "server" {
type = "Microsoft.Sql/servers@2022-05-01-preview"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
administratorLogin = "mradministrator"
administratorLoginPassword = "thisIsDog11"
minimalTlsVersion = "1.2"
publicNetworkAccess = "Enabled"
restrictOutboundNetworkAccess = "Disabled"
version = "12.0"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}

resource "azapi_update_resource" "auditingSettings" {
type = "Microsoft.Sql/servers/auditingSettings@2022-05-01-preview"
name = "default"
parent_id = azapi_resource.server.id
body = {
properties = {
auditActionsAndGroups = [
"FAILED_DATABASE_AUTHENTICATION_GROUP",
"SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP"
]
isAzureMonitorTargetEnabled = true
state = "Enabled"
}
}
}

0 comments on commit c27391a

Please sign in to comment.