- PowerShell 7 - (tested with v7.1.0 (Nov 2020), v7.1.1 (Jan 2021))
- PowerShell Az module - (tested with v4.2.0 (July 2020), v5.4.0 (Jan 2021))
- Clone or download this repo.
- Navigate to the folder containing the local version of this repo in PowerShell
- Create target resource group using Azure Portal, Az PowerShell or Azure CLI.
- Update parameter file as required Default provided in
parameters
file - see Parameters section for details. - Run the interactive deployment script: (this will securely prompt for administrator password)
$ .\deploy\interactive.ps1 -ResourceGroupName 'test-mysql-resource-group'
Enter admin password: **********
DeploymentName : template
ResourceGroupName : test-client-mysql-resource-group
ProvisioningState : Succeeded
Timestamp : 19/01/2021 14:54:57
Mode : Incremental
TemplateLink :
Parameters :
Name Type Value
============================ ========================= ==========
administratorLogin String gracehopper
administratorLoginPassword SecureString
location String uksouth
serverName String test-server-name
skuCapacity Int 2
skuFamily String Gen5
skuName String B_Gen5_2
skuSizeMB Int 51200
skuTier String Basic
version String 5.7
backupRetentionDays Int 7
geoRedundantBackup String Disabled
previewFeature String
tags Object {}
storageAutoGrow String Enabled
infrastructureEncryption String Disabled
firewallRules Array []
Outputs :
DeploymentDebugLogLevel :
Most of the parameters below match closely with their equivalents for the related resource templates in which they are used, all of which are documented on https://docs.microsoft.com/en-us/azure/templates/.
A non-null value must be provided - see ServerPropertiesForDefaultCreate object for usage. For automated deployments this value is best set from a value stored in an existing Key Vault.
"parameters": {
"administratorLogin": {
"value": null
},
}
You can supply non-null value here, but it is strongly recommended that you do not. For interactive deployments it is preferable to use the ability of the New-AzResourceGroupDeployment cmdlet to provide values for template parameters - see provided deployment script for an example of this. For automated deployments this value is best set from a value stored in an existing Key Vault.
"parameters": {
"administratorLoginPassword": {
"value": null
},
}
A non-null value must be provided - see Microsoft.DBforMySQL/servers object for usage.
"parameters": {
"serverName": {
"value": "my-mysql-server"
},
}
Default provided in parameters
file - see Microsoft.DBforMySQL/servers object for usage.
"parameters": {
"location": {
"value": "uksouth"
},
}
Default provided in parameters
file - see SKU object for usage.
"parameters": {
"skuName": {
"value": "B_Gen5_2"
},
}
Default provided in parameters
file - see SKU object for usage.
"parameters": {
"skuTier": {
"value": "Basic"
},
}
Default provided in parameters
file - see SKU object for usage.
"parameters": {
"skuCapacity": {
"value": 2
},
}
Default provided in parameters
file - see SKU object for usage.
"parameters": {
"skuFamily": {
"value": "Gen5"
},
}
Default provided in parameters
file - see SKU object for usage.
"parameters": {
"skuSizeMB": {
"value": 51200
},
}
Default provided in parameters
file - see StorageProfile object for usage.
"parameters": {
"backupRetentionDays": {
"value": 7
},
}
Default provided in parameters
file - see StorageProfile object for usage.
"parameters": {
"geoRedundantBackup": {
"value": "Disabled"
},
}
Default provided in parameters
file - see StorageProfile object for usage.
"parameters": {
"storageAutoGrow": {
"value": "Enabled"
},
}
Default provided in parameters
file - see Microsoft.DBforMySQL/servers object for usage.
"parameters": {
"tags": {
"value": {}
},
}
Default provided in parameters
file - see ServerPropertiesForCreate object for usage.
"parameters": {
"infrastructureEncryption": {
"value": "Disabled"
},
}
Default provided in parameters
file - see ServerPropertiesForCreate object for usage.
"parameters": {
"version": {
"value": "5.7"
},
}
For each firewall rule add an object with these properties to the value
array
of this parameter.
{
"name": "<fw-rule-name>",
"startIpAddress": "<valid-ipv4-address>",
"endIpAddress": "<valid-ipv4-address>"
}
See Microsoft.DBforMySQL servers/firewallRules for details of these properties.
Example:
"parameters": {
"firewallRules": {
"value": [
{
"name": "Office",
"startIpAddress": "127.0.0.1",
"endIpAddress": "127.0.0.1"
}
]
}
}
Note: the invalid value 127.0.0.1
(for a public IP address)is used above deliberately in order to prevent accidentally opening a hole in the firewall from copy & pasting this example.
To allow access from any Azure IP you can set both startIpAddress
and endIpAddress
to "0.0.0.0"
as shown below.
Note: this is not recommended for most scenarios and should only be used where no other option exists and you fully appreciate the security impact of this decision.
"parameters": {
"firewallRules": {
"value": [
{
"name": "AllowAllAzureIPs",
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
}
]
}
}