1. 기본 골격

1) parameters :  기본 변수 항목 지정

2) variables : parameter에 대한 값 지정

3) resources : 실제 azure resoruce 생성 부분

 

==================== 기본 예제 ==============================

 

아래 예제는 TLS disable하고 public 오픈도 disable하여 mysql 구성

 

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {

    },
    "variables": {},
    "resources": [

        {
            "type": "Microsoft.DBforMySQL/servers",
            "apiVersion": "2017-12-01",
            "name": "[parameters('db_server_name')]",
            "location": "[resourceGroup().location]",
            "sku": {
                "name": "[parameters('skuName')]",
                "tier": "[parameters('skuTier')]",
                "family": "[parameters('skuFamily')]",
                "capacity": "[parameters('skuCapacity')]"
            },
            "properties": {
                "storageProfile": {
                    "storageMB": "[parameters('skuSizeMB')]",
                    "backupRetentionDays": "[parameters('backupRetentionDays')]",
                    "geoRedundantBackup": "Disabled",
                    "storageAutogrow": "Enabled"
                },
                "version": "[parameters('mysqlVersion')]",
                "administratorLogin": "[parameters('administratorLogin')]",
                "administratorLoginPassword": "[parameters('administratorLoginPassword')]",
                "sslEnforcement": "Disabled",
                "minimalTlsVersion": "TLSEnforcementDisabled",
                "infrastructureEncryption": "Disabled",
                "publicNetworkAccess": "Disabled"
            }
        }

    ]
}

 

아래는 실제 셋팅 예제

mysql_template.json
0.01MB

 

2.  Azure Shell에서 template 수행

 

# subscription 변경

Select-AzSubscription -Subscription onestore_qa 

 

# 각 변수 지정

$resourceGroupName='qa-rg-test'
$adminUser='testuser'
$adminPassword = Read-Host -Prompt "Enter the administrator password" -AsSecureString

 

# mysql resource 생성

New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName `
       -administratorLogin $adminUser `
       -administratorLoginPassword $adminPassword `
       -TemplateFile $HOME/mysql_template.json

 

 

 

'cloud > azure' 카테고리의 다른 글

Azure vm disk 용량 증설  (0) 2021.07.15
Azure linux와 disk lun 맵핑  (0) 2021.07.14
Azure for mysql replication 구성  (0) 2021.07.08
azure 전용선 (express route) 연결  (0) 2021.06.11
azure 네트웍 구성  (0) 2021.06.04

+ Recent posts