Skip to content

Instantly share code, notes, and snippets.

@cmaneu
Last active November 30, 2021 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmaneu/38d095e45fc56f9a46f9bdb38bb46ed8 to your computer and use it in GitHub Desktop.
Save cmaneu/38d095e45fc56f9a46f9bdb38bb46ed8 to your computer and use it in GitHub Desktop.
Azure SQL Bicep
// App Service - Bicep module
// Generated by NubesGen (www.nubesgen.com)
// Module requirements
// Serverless tier or General Purpose GP_Gen5_2
// Outputs: database URL, username & password
// Check integration with App Service + Key Vault
@description('The name of your application')
param applicationName string
@description('The environment (dev, test, prod, ...')
@maxLength(4)
param environment string = 'dev'
@description('The number of this specific instance')
@maxLength(3)
param instanceNumber string = '001'
@description('The Azure region where all resources in this example should be created')
param location string
@description('A list of tags to apply to the resources')
param tags object
@description('The name of the SQL logical server.')
param serverName string = 'sql-${applicationName}-${environment}-${instanceNumber}'
@description('The name of the SQL Database.')
param sqlDBName string = applicationName
@description('The administrator username of the SQL logical server.')
param administratorLogin string = 'sql${replace(applicationName, '-', '')}root'
@description('The administrator password of the SQL logical server.')
@secure()
param administratorLoginPassword string = newGuid()
resource serverName_resource 'Microsoft.Sql/servers@2020-02-02-preview' = {
name: serverName
location: location
properties: {
administratorLogin: administratorLogin
administratorLoginPassword: administratorLoginPassword
}
}
resource serverName_sqlDBName 'Microsoft.Sql/servers/databases@2020-08-01-preview' = {
parent: serverName_resource
name: sqlDBName
location: location
tags: tags
sku: {
name: 'GP_S_Gen5_1'
}
properties: {
autoPauseDelay: 60
collation: 'SQL_Latin1_General_CP1_CI_AS'
minCapacity: '0.5'
}
}
// Outputs: database URL, username & password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment