DB@Azure · TERRAFORM · ORACLE 19c

Provision Oracle Autonomous Database 19c on Azure with Terraform and connect from Windows

Share on LinkedIn ↗

Create an Oracle Autonomous Database Serverless lab on Azure using Terraform from your Windows laptop, then connect to its private endpoint with SQL Developer. This guide covers the Marketplace subscription, Oracle account activation, Azure networking, database creation, and a small Linux VM that carries an SSH tunnel from your laptop.

The verified lab used Oracle 19c, 2 ECPUs, and 20 GB of storage. The final SQL Developer queries returned the connected user, database name, and Oracle Database version. Terraform ran locally throughout; GitHub holds the reusable source code.

1. Subscribe to Oracle AI Database@Azure

In Azure Portal, search Marketplace for Oracle AI Database@Azure. Select your Azure subscription and the Oracle Database@Azure Pay As You Go plan, then select Subscribe.

Oracle AI Database@Azure Marketplace offer
Select the Oracle Marketplace offer and the Azure subscription that will own the lab.

Complete Basics, review Consent, and continue to Review + create. Read the offer terms and billing details before selecting Create. This is a paid usage-based service.

Oracle subscription Basics
The lab used the public Pay As You Go offer.

After deployment completes, open OracleSubscriptions → default. The Marketplace purchase and Oracle account activation are separate steps. Select the banner to configure your Oracle Cloud account and complete the activation flow.

Use Oracle’s prerequisites guide to confirm the account requirements for your offer. This lab created a new Oracle Cloud account through the Azure onboarding flow.

Choose the home region carefully; enter passwords privately. Return to the Oracle subscription in Azure and continue once Oracle Cloud Account → Status shows Activated.

Oracle Cloud account activated in Azure
Activated confirms that the Oracle account setup has completed.

In this lab, the time from Marketplace submission at approximately 10:10 PM CST on November 8, 2026, to the account-ready email at 1:37 AM CST on November 9, was approximately 3 hours 27 minutes. This was onboarding time; database creation was a later operation. Completion times vary.

2. Complete the Azure prerequisites

You need permission to purchase the offer, complete Oracle account linking, register providers and features, and create the lab resources. Billing permissions and Azure resource permissions have different scopes. Have the appropriate administrators complete the tasks listed in Oracle’s prerequisites and permissions guide.

Under Subscriptions → your subscription → Settings → Resource providers, confirm these providers are registered:

Provider Purpose in this lab
Oracle.Database Oracle database resources
Microsoft.BareMetal Oracle service integration prerequisites
Microsoft.Network VNet, subnets, NIC, public IP and security rules
Microsoft.Compute Linux client VM
Oracle resource provider registered
Confirm Oracle.Database shows Registered. Check the other providers in the same view.

Register the advanced networking features before creating the delegated subnet

For this lab, both registrations were completed before Terraform created the Oracle subnet. Open Settings → Preview features, search for EnableRotterdamSdnApplianceForOracle, select the entries under Microsoft.Baremetal and Microsoft.Network, and select Register.

Advanced networking registrations
Both feature entries must finish registering before proceeding with this advanced-networking setup.

See Microsoft’s network planning guide for feature prerequisites and supported regions. Use Oracle’s delegated subnet instructions for the Terraform delegation configuration.

3. Understand the connection path

Terraform uses your Azure CLI sign-in to create the resources. SQL Developer stays on your Windows laptop. Because the database is private, its traffic travels through a Linux VM in the same Azure VNet.

Provision from your Windows laptopAzure CLI sign-inLocal TerraformAzure resourcesConnect from SQL DeveloperSQL DeveloperWallet on WindowsLocal SSH tunnel127.0.0.1:1522Linux client VMClient subnetOracle 19cDelegated subnetVM and database use separate subnets in the same Azure VNet

The VNet has two separate subnets: a client subnet for the VM and an Oracle-delegated subnet for the database. The VM does not belong in the delegated subnet. No VNet peering is needed between these two subnets in the same VNet. Successful access still depends on routing, security rules, name resolution and database authentication.

4. Prepare your Windows laptop

Install Terraform, Azure CLI, Git, VS Code and SQL Developer. Windows OpenSSH provides the SSH client. Open a fresh PowerShell window after installing Azure CLI so the updated PATH is loaded.

terraform version
az version
git --version
ssh -V

The verified workstation used Terraform 1.16.6, Azure CLI 2.92.0, AzureRM 4.81.0 and AzAPI 2.13.0. Keep the repository’s provider lock file to retain its provider selections.

Azure CLI installation verified
Check the installed tools before beginning the deployment.

Sign in to Azure from PowerShell:

az login --use-device-code

Open the URL displayed by the command in Chrome, enter the displayed device code, and complete sign-in and MFA privately. Back in PowerShell, select the intended subscription. Then confirm the selected account:

az account show --query "{Subscription:name,Status:state}" --output table
Azure CLI selected subscription
The CLI must be signed in separately from the Azure Portal browser session.

5. Download the Terraform code and inspect the files

The source is available in oracledb-azure-adbs-terraform on GitHub.

For a new deployment, download the reference code, then create a separate working folder. Copy each stage into that same working folder as you progress:

Set-Location "$env:USERPROFILE\Documents"
git clone https://github.com/venkatcloudlearner-cell/oracledb-azure-adbs-terraform.git DB-Azure-ADBS-source
$sourcePath = "$env:USERPROFILE\Documents\DB-Azure-ADBS-source"
New-Item -ItemType Directory -Path "$env:USERPROFILE\Documents\DB-Azure-ADBS"
Set-Location "$env:USERPROFILE\Documents\DB-Azure-ADBS"
Copy-Item "$sourcePath\.terraform.lock.hcl" .
code .

If you already created this lab, continue in its original Terraform folder and state. Do not deploy a fresh clone against those existing resource names.

File What it controls
versions.tf Terraform/provider requirements and subscription configuration
variables.tf Inputs and validation rules
terraform.tfvars.example Example settings to copy and customize
main.tf Resource group
network.tf Virtual network
subnet.tf Oracle-delegated subnet
database.tf Private 19c Autonomous Database
client.tf Client subnet, security group, public IP, NIC and Linux VM
outputs.tf Database and network results; client outputs also appear in client.tf
Set-DatabasePassword.ps1 Hidden password entry for the current PowerShell session
.terraform.lock.hcl Selected provider versions and checksums

Terraform reads all .tf files in the folder together. A filename organizes the code; references define dependencies. For example, the VNet refers to the resource group, and the database refers to the Oracle subnet.

The state file records resources that Terraform already manages. On later plans, unchanged resources are retained. A saved plan such as lab.tfplan is a proposed set of changes, not another source file.

6. Set the deployment values

Copy the example file:

Copy-Item "$sourcePath\terraform.tfvars.example" terraform.tfvars

Replace the subscription placeholder with your own Azure subscription ID. The repository uses example private ranges rather than the original lab’s addresses. Choose non-overlapping ranges for your environment.

subscription_id      = "YOUR_AZURE_SUBSCRIPTION_ID"
location             = "eastus2"
resource_group_name  = "rg-adbs-azure-lab"
virtual_network_name = "vnet-adbs-azure-lab"
virtual_network_cidr = "10.XXX.0.0/16"
oracle_subnet_name   = "snet-oracle-adbs"
oracle_subnet_cidr   = "10.XXX.2.0/27"
database_name        = "adbsazurelab01"
database_version     = "19c"

The client subnet is derived from the VNet range using cidrsubnet(var.virtual_network_cidr, 8, 1). With the example /16 above, that produces 10.XXX.1.0/24. The Oracle subnet remains separate.

The database configuration requests 2 ECPUs, 20 GB, License Included, private network access and required mTLS. Both compute and storage autoscaling are disabled. The database uses AzAPI to request storage explicitly in GB; the AzureRM version used in this build exposed database storage in TB.

No optional backup job or long-term backup schedule was added. Service-managed automatic backups remain part of the database service; this lab configured a one-day retention period.

7. Provision the network and database with Terraform

Follow the sequence used in the lab: resource group → VNet → Oracle-delegated subnet → database. Review and apply one addition before moving to the next.

The repository's walkthrough folders contain cumulative configurations for these stages. Copy each stage into the same DB-Azure-ADBS working folder. Keep its .terraform directory, lock file, terraform.tfvars and terraform.tfstate between steps. Terraform uses that state to recognize resources it already created.

These instructions start a new deployment. For an existing lab, keep using its original configuration and state; do not overwrite it with an earlier stage.

Step 7.1 Create the resource group

Copy the first stage into the working folder:

Copy-Item "$sourcePath\walkthrough\01-resource-group\*.tf" .

In VS Code, click main.tf. It contains one Azure resource:

resource "azurerm_resource_group" "lab" {
  name     = var.resource_group_name
  location = var.location

  tags = {
    Project     = "DB-Azure-ADBS"
    Environment = "Lab"
    ManagedBy   = "Terraform"
  }
}

The resource group name and region come from terraform.tfvars. variables.tf declares those inputs, and outputs.tf prints the resulting name and location.

Resource group configuration in VS Code
At this stage, main.tf is the only file defining an Azure resource.

In PowerShell, initialize Terraform and review the resource group plan:

terraform init
terraform validate
terraform plan '-out=resource-group.tfplan'

Expect 1 to add, 0 to change, 0 to destroy. Confirm the proposed resource is azurerm_resource_group.lab, named rg-adbs-azure-lab in eastus2. Then run:

terraform apply 'resource-group.tfplan'
Resource group created by Terraform
The resource group completed in 23 seconds. Terraform reports one resource added.

In Azure Portal, open Resource groups and confirm rg-adbs-azure-lab exists. Keep PowerShell in the same working folder for the next stage.

Step 7.2 Create the VNet

Copy the second stage. It retains the resource group definition, adds network.tf, and updates the outputs:

Copy-Item "$sourcePath\walkthrough\02-vnet\*.tf" . -Force

Open network.tf in VS Code:

resource "azurerm_virtual_network" "lab" {
  name                = var.virtual_network_name
  location            = azurerm_resource_group.lab.location
  resource_group_name = azurerm_resource_group.lab.name
  address_space       = [var.virtual_network_cidr]

  tags = azurerm_resource_group.lab.tags
}

address_space reads the VNet range you entered in terraform.tfvars. The references to azurerm_resource_group.lab reuse the group created in the previous step.

VNet definition in VS Code
network.tf links the VNet to the existing resource group.

Run:

terraform validate
terraform plan '-out=vnet.tfplan'

Expect 1 to add, 0 to change, 0 to destroy, with azurerm_virtual_network.lab as the new resource. Terraform refreshes the resource group's state, but does not recreate an unchanged group.

terraform apply 'vnet.tfplan'
VNet created by Terraform
VNet creation took 6 seconds. The existing resource group was retained.

In Azure Portal, open rg-adbs-azure-lab → vnet-adbs-azure-lab → Address space. Confirm that the range matches your configuration.

Step 7.3 Create the Oracle-delegated subnet

Confirm the advanced networking registrations from section 2 are complete. Then copy the third stage:

Copy-Item "$sourcePath\walkthrough\03-delegated-subnet\*.tf" . -Force

Open subnet.tf. The azurerm_subnet.oracle block creates snet-oracle-adbs inside the VNet, using the range in oracle_subnet_cidr. Its delegation block is:

delegation {
  name = "oracle-database-delegation"

  service_delegation {
    name = "Oracle.Database/networkAttachments"
    actions = [
      "Microsoft.Network/networkinterfaces/*",
      "Microsoft.Network/virtualNetworks/subnets/join/action",
    ]
  }
}

The delegation reserves this subnet for Oracle service attachments. The connection VM will later use a separate client subnet.

terraform validate
terraform plan '-out=delegated-subnet.tfplan'

Expect 1 to add, 0 to change, 0 to destroy. Review the subnet name, address range, VNet and delegation.

Oracle delegated subnet plan
The plan shows the new subnet and Oracle.Database/networkAttachments delegation.

Apply the reviewed plan:

terraform apply 'delegated-subnet.tfplan'
terraform output

The subnet creation took 6 seconds in the lab. Confirm the outputs include oracle_subnet_name and oracle_subnet_delegation.

In Azure Portal, open vnet-adbs-azure-lab → Subnets → snet-oracle-adbs and confirm the Oracle delegation. The database network is now ready.

Step 7.4 Create the private Oracle 19c database

Copy the fourth stage and password-entry helper:

Copy-Item "$sourcePath\walkthrough\04-database\*.tf" . -Force
Copy-Item "$sourcePath\walkthrough\04-database\Set-DatabasePassword.ps1" .

Open versions.tf. This stage adds AzAPI alongside AzureRM, so run initialization again to install the newly required provider:

terraform init
terraform validate
Terraform initializes the database provider
AzAPI manages the database; AzureRM continues managing the network resources.

Open database.tf and review these settings:

Setting Lab configuration
Database version 19c
Workload Transaction Processing
Compute model and count ECPU, 2
Allocated storage 20 GB
License model License Included
Compute and storage autoscaling Disabled
Network Existing VNet and Oracle-delegated subnet
Mutual TLS Required

The database references azurerm_virtual_network.lab.id and azurerm_subnet.oracle.id, so it uses the network just created.

Load the database ADMIN password privately and generate the plan:

.\Set-DatabasePassword.ps1
terraform plan '-out=database.tfplan'

Keep the password for the later SQL Developer connection. It is a sensitive, ephemeral input passed through AzAPI's write-only field, so it is not stored in the saved plan or Terraform state. Keep this PowerShell session open through apply.

Expect 1 to add, 0 to change, 0 to destroy. The only new managed resource should be azapi_resource.database. The resource group, VNet and subnet should remain unchanged.

Apply the reviewed plan once:

terraform apply 'database.tfplan'

Keep the terminal open while Terraform reports Still creating. The verified database creation completed after 25 minutes 12 seconds:

Database creation completed
Apply complete confirms one database added. The output reports provisioning state Succeeded.

After success:

terraform output
Remove-Item Env:TF_VAR_admin_password

You now have the resource group, VNet, delegated subnet and database, all tracked in the same Terraform state. Next, confirm the database is Available in Azure before creating the connection VM.

Run each saved plan once. Generate a fresh plan for later changes; an already-used plan can become stale after state changes. Keep state, plans, actual tfvars, private keys and wallets out of source control.

8. Confirm the database and download its wallet

In Azure Portal, open Oracle Autonomous Databases → adbsazurelab01 → Overview. Confirm Available, 19c, 2 ECPUs, 20 GB, private VNet access and required mutual TLS.

Azure database Overview
Azure shows the database configuration and its private network endpoint.

Select Go to OCI, then open Database connection on the Oracle database page. Download the instance wallet, entering its password privately when requested. Keep the ZIP on your Windows laptop for SQL Developer.

Oracle database connection entry point
Use Database connection to obtain the wallet for this database.

The lab used Wallet_adbsazurelab01.zip. A wallet supplies connection information and client certificates; it does not create a network path from your laptop to the private database. See Oracle’s connection instructions.

9. Provision the Azure client VM

The database is now provisioned. Next create the VM that will carry the desktop tunnel. It uses a separate client subnet in the same VNet.

The private key stays on your laptop. Terraform installs only the public key on the VM.

New-Item -ItemType Directory -Path "$env:USERPROFILE\.ssh" -Force | Out-Null
$keyPath = "$env:USERPROFILE\.ssh\azure-adbs-lab"

if (Test-Path $keyPath) {
    Write-Host "Keeping the existing key."
} else {
    ssh-keygen -t rsa -b 3072 -f $keyPath -C "azure-adbs-lab"
}

If prompted, enter and confirm a passphrase privately. Do not upload the private key to GitHub or copy it into a blog screenshot.

SSH key files on the laptop
The .pub file is the public key. The file without that extension is private.

Restrict the VM’s inbound SSH rule to your current public IPv4 address:

$myPublicIp = (Invoke-RestMethod -Uri "https://api4.ipify.org").Trim()
$env:TF_VAR_client_ssh_source_cidr = "$myPublicIp/32"

The rule permits TCP 22 from one address. If your public IP changes, update this value and review a new Terraform plan.

The final client.tf in the repository contains the verified VM size and separates VM networking from the Oracle-delegated subnet.

Before deployment, check Azure Portal → Quotas → Compute, filtered to your region. A VM needs both regional availability and enough quota for its family. This lab ultimately used Standard_F1als_v7, with 1 vCPU, 2 GB RAM, Ubuntu 22.04 Gen2, an NVMe controller and a 30 GB standard disk. Select an available size appropriate for your own subscription and review its price.

Enable the VM configuration and review its plan

Copy the fifth cumulative stage into the same working folder. It keeps the existing definitions and adds client.tf:

Copy-Item "$sourcePath\walkthrough\05-client\*.tf" . -Force

In VS Code, open client.tf and review these blocks before running the plan:

Block What it creates
azurerm_subnet.client Separate client subnet inside the VNet
azurerm_network_security_group.client Inbound SSH rule restricted to your public IP
azurerm_public_ip.client Public IP for the SSH connection
azurerm_network_interface.client VM network interface
azurerm_network_interface_security_group_association.client Security group attached to the interface
azurerm_linux_virtual_machine.client Ubuntu VM with your public SSH key

Use the same database ADMIN password when reloading the helper for later plans:

.\Set-DatabasePassword.ps1
terraform validate
terraform plan '-out=client-vm.tfplan'

The expected plan is 6 to add, 0 to change, 0 to destroy. The resource group, VNet, Oracle subnet and database should remain unchanged.

After reviewing the plan, apply it:

terraform apply 'client-vm.tfplan'
terraform output
Remove-Item Env:TF_VAR_admin_password
Azure client VM creation completed
The verified Linux VM creation took 22 seconds. This screenshot shows the final VM-only apply after its five networking resources had already been created; a fresh client-stage apply reports six additions.

Save client_public_ip and client_admin_username from the outputs. The next steps verify SSH access and the private database listener before configuring SQL Developer.

10. Verify the VM can reach the database

In PowerShell, get the VM address and check SSH access:

$vmPublicIp = terraform output -raw client_public_ip
Test-NetConnection -ComputerName $vmPublicIp -Port 22
Laptop SSH port check
TcpTestSucceeded: True confirms the laptop can reach the VM’s SSH port.

Before the first SSH login, obtain the VM’s host fingerprint through Azure’s authenticated management channel:

az vm run-command invoke --resource-group rg-adbs-azure-lab --name vm-adbs-client --command-id RunShellScript --scripts 'ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub' --query 'value[].message' --output tsv

ssh -i "$env:USERPROFILE\.ssh\azure-adbs-lab" "azureuser@$vmPublicIp"

Compare the SSH prompt’s ED25519 fingerprint with the Azure result before accepting it. Enter your key passphrase if prompted.

SSH login to Ubuntu client
SQL Developer stays on Windows; this VM provides the private network path.

Read the current Database private IP from Azure Overview. At the Linux prompt, replace the placeholder below with that address:

timeout 5 bash -c 'echo > /dev/tcp/YOUR_DATABASE_PRIVATE_IP/1522' \
  && echo "Database listener reachable on port 1522" \
  || echo "Database listener connection failed"
Private database listener reachable
This verifies TCP reachability from the client VM to the database listener.

11. Bring the private connection to Windows

Leave the Linux shell with exit. In Windows PowerShell, assign the current database private IP and open a local forward:

$dbPrivateIp = "YOUR_DATABASE_PRIVATE_IP"

ssh -i "$env:USERPROFILE\.ssh\azure-adbs-lab" -N -L "127.0.0.1:1522:${dbPrivateIp}:1522" -o ExitOnForwardFailure=yes -o ServerAliveInterval=30 "azureuser@$vmPublicIp"

This binds the laptop’s loopback port 1522, carries traffic over SSH to the VM, and forwards it to database port 1522. If another lab already uses local port 1522, close that tunnel first.

SSH tunnel running
No returned prompt is expected with -N. Keep this window running during SQL Developer use.

Preserve the wallet hostname and TLS verification

Open tnsnames.ora inside your wallet ZIP and find the HOST and PORT for the chosen service. Preserve that hostname and the wallet’s server-DN matching setting.

Open a second PowerShell window as Administrator. Enter the exact hostname from your own wallet:

$hostsPath = "$env:windir\System32\drivers\etc\hosts"
$walletHost = "YOUR_EXACT_WALLET_HOSTNAME"

Copy-Item -LiteralPath $hostsPath -Destination "$hostsPath.azure-adbs-$(Get-Date -Format yyyyMMdd-HHmmss).bak"

if (-not (Select-String -LiteralPath $hostsPath -SimpleMatch $walletHost -Quiet)) {
    Add-Content -LiteralPath $hostsPath -Value "`r`n127.0.0.1 $walletHost # Azure ADBS SSH tunnel"
}

ipconfig /flushdns
ping -n 1 $walletHost

If an entry already exists for this hostname, inspect it and confirm it maps to loopback; do not add conflicting mappings. Keep unrelated hosts entries intact.

Wallet hostname resolves to loopback
The wallet hostname resolves to 127.0.0.1, sending the connection into the open tunnel.

The HOST remains the original wallet hostname from SQL Developer’s perspective. Only its local address resolution changes. Do not disable TLS certificate or server-DN verification.

12. Connect with SQL Developer

Create a new connection using these settings:

Setting Value
Connection name AzureADBS
Database type Oracle
Username ADMIN
Password Your database ADMIN password
Role default
Connection type Cloud Wallet
Configuration file Wallet_adbsazurelab01.zip
Service adbsazurelab01_low

Select Test. After Status: Success, select Save, then Connect.

SQL Developer connection succeeds
The wallet connection succeeds through the Windows SSH tunnel.

In the AzureADBS worksheet, run:

SELECT USER AS connected_user,
       SYS_CONTEXT('USERENV', 'DB_NAME') AS database_name
FROM dual;

SELECT banner_full
FROM v$version;

Use F5 for script output, or select each statement and use Ctrl+Enter for its result grid.

Connected user and database verified
The lab returned ADMIN and a database name ending in ADBSAZURELAB01.
Oracle Database 19c version verified
The database reported Oracle Database 19c Enterprise Edition, version 19.33.0.1.0.

Conclusion

This lab provisioned a private Oracle Autonomous Database Serverless 19c instance on Azure using Terraform from a Windows laptop. The same configuration defined the resource group, VNet, Oracle-delegated subnet, database and client VM. SQL Developer then connected from Windows using the database wallet and an SSH tunnel through the Azure client VM.

The final queries verified both database identity and Oracle 19c. Keeping the configuration in GitHub makes the setup reusable: update the subscription, names and approved address ranges, review the Terraform plan, and deploy from your own Windows session.

Share on LinkedIn ↗

Join the discussion

Ask a question, share a result, or add a useful tip.

Loading comments…

Leave a comment

Your name and comment will be public. Keep passwords, email addresses, IP addresses, and other private details out of your comment. Cloudflare Turnstile checks submissions to help prevent spam.