π νμ΅λͺ©ν
1. ARM ν νλ¦Ώμ μ¬μ© μ΄ν΄
2. ARM ν νλ¦Ώμ λν μ€μ κ²½ν
3. bicepμ μ¬μ© μ΄ν΄
Azureμ μμμ μ μνκ³ κ΅¬μ±νλ μ μΈμ λ°©μμ μ 곡νλ JSON νμΌμ λλ€.
ARM ν νλ¦Ώμ μ¬μ©νλ©΄ μ¬λ¬ Azure μμμ λ°°ν¬μ ꡬμ±μ μλννκ³ μΌκ΄μ±μ μ μ§ν μ μμ΅λλ€.
ARM ν νλ¦Ώμ Azure μμμ λ°°ν¬μ ꡬμ±μ μ ννκ³ μΌκ΄μ± μκ² μλννλ "λ§€λ΄μΌ"λ‘ λ³Ό μ μμΌλ©°, μμ κ²½μ° μμμ μΌλ‘ λ°λ³΅μ μΈ μμ μ ν΄μΌ νκ³ μ€μμ κ°λ₯μ±λ λμμ§λλ€.
VSCdoeμμ azuredeploy.json νμΌμ λ§λλλ€.
νλ¨μ λ΄μ©μ json νμΌμ λΆμ¬λ£κΈ° ν©λλ€.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": []
}
$schema: μ΄ νλλ μ¬μ©λλ μ€ν€λ§μ URIλ₯Ό μ μν©λλ€. μ΄κ²μ ARM ν
νλ¦Ώμ λ²μ λ° μ ν¨μ±μ νμΈνλ λ° μ¬μ©λ©λλ€. μ΄ κ²½μ°, 2019-04-01 λ²μ μ ARM ν
νλ¦Ώ μ€ν€λ§λ₯Ό μ¬μ©νκ³ μμ΅λλ€.
contentVersion: ν
νλ¦Ώμ λ²μ μ λνλ
λλ€. μ΄ νλλ μ¬μ©μκ° μ μν μ μμΌλ©°, λ°°ν¬ λ΄μμ μΆμ νκ±°λ λ€μν ν
νλ¦Ώ λ²μ μ κ΄λ¦¬νλ λ° μ¬μ©λ μ μμ΅λλ€.
resources: μ΄ λ°°μ΄μ ν
νλ¦Ώμμ λ°°ν¬ν Azure μμλ€μ μ μν©λλ€. μ΄ μμ μμλ μλ¬΄λ° μμλ μ μλμ΄ μμ§ μμΌλ―λ‘, λΉ λ°°μ΄([])λ‘ νμλμ΄ μμ΅λλ€.
Azureμ λ‘κ·ΈμΈμ ν©λλ€.
az login
λ§μ½μ ꡬλ
κ³μ μ΄ μ¬λ¬κ° μλ€λ©΄ ꡬλ
κ³μ μ΄λ¦ λλ μμ΄λλ₯Ό SubscriptionName λμ μ μ
λ ₯ν©λλ€.
az account set --subscription SubscriptionName
리μμ€ κ·Έλ£Ήμ νλ¨μ μ½λμ²λΌ λ§λλλ€.
az group create \
--name myResourceGroup \
--location 'Central US'
az group create: azλ Azure CLIμ κΈ°λ³Έ λͺ
λ Ήμ΄μ΄λ©°, group createλ 리μμ€ κ·Έλ£Ήμ μμ±νλ μμ
μ μ§μν©λλ€.
--name myResourceGroup: μμ±ν 리μμ€ κ·Έλ£Ήμ μ΄λ¦μ μ§μ νλλ° μ¬μ©λ©λλ€. μ¬κΈ°μλ"myResourceGroup"μ΄λΌλ μ΄λ¦μ 리μμ€ κ·Έλ£Ήμ μμ±νλλ‘ μ§μ λμ΄ μμ΅λλ€.
--location 'Central US': 리μμ€ κ·Έλ£Ήμ νΈμ€ν
ν Azure 리μ (λ°μ΄ν° μΌν°μ μμΉ)μ μ§μ ν©λλ€.
μλ μ½λμ {}λΆλΆκΉμ§ μ κ±°νκ³ νμΌ κ²½λ‘λ₯Ό λ£μ΅λλ€.
(νμΌ κ²½λ‘λ vscodeμμ νμΌμ μ° ν΄λ¦νλ©΄ μ μ μμ΅λλ€.)
templateFile="{provide-the-path-to-the-template-file}"
az deployment group create \
--name blanktemplate \
--resource-group myResourceGroup \
--template-file $templateFile
μλμ μ½λλ₯Ό νμΈν μ μμΌλ©΄ λ°°ν¬μ μ±κ³΅ν κ²μ λλ€.
"provisioningState": "Succeeded",

1 succeededλ₯Ό ν΄λ¦ν©λλ€.

{provide-unique-name}μ κ³ μ μ μ€ν λ¦¬μ§ κ³μ μ΄λ¦μ λ§λ€μ΄μ€λλ€. μ λ μμμ²λΌ κ·Έλ₯ store1abc06132022μμ μ΄μ§λ§ λ³κ²½νμ΅λλ€.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-09-01",
"name": "{provide-unique-name}",
"location": "eastus",
"sku": {
"name": "Standard_LRS"
},
"kind": "StorageV2",
"properties": {
"supportsHttpsTrafficOnly": true
}
}
]
}
resources: λ°°ν¬νλ €λ Azure 리μμ€λ₯Ό μ μνλ λ°°μ΄μ
λλ€. μ¬κΈ°μλ λ¨ νλμ 리μμ€, μ¦ μ€ν λ¦¬μ§ κ³μ μ΄ μ μλμ΄ μμ΅λλ€.
type: "Microsoft.Storage/storageAccounts": 리μμ€μ μ νμ μ§μ ν©λλ€. μ¬κΈ°μλ μ€ν λ¦¬μ§ κ³μ μ μλ―Έν©λλ€.
apiVersion: "2021-09-01": 리μμ€λ₯Ό μμ±νλ λ° μ¬μ©ν Azure APIμ λ²μ μ λνλ
λλ€.
name: "{provide-unique-name}": μμ±λ μ€ν λ¦¬μ§ κ³μ μ μ΄λ¦μ
λλ€. μ¬μ©μλ μ¬κΈ°μ κ³ μ ν μ΄λ¦μ μ 곡ν΄μΌ ν©λλ€.
location: "eastus": μ€ν λ¦¬μ§ κ³μ μ΄ μμ±λ Azure 리μ μ λνλ
λλ€. μ¬κΈ°μλ "eastus" (λ―Έκ΅ λλΆ) 리μ μ μμ±λ©λλ€.
sku: { "name": "Standard_LRS" }: μ€ν λ¦¬μ§ κ³μ μ μ ν λ° λ³΅μ κΈ°λ₯μ μ§μ ν©λλ€. Standard_LRSλ νμ€ μ±λ₯μ λ‘컬 μ€λ³΅ μ€ν 리μ§λ₯Ό λνλ
λλ€.
kind: "StorageV2": μ€ν λ¦¬μ§ κ³μ μ μ’
λ₯λ₯Ό λνλ
λλ€. StorageV2λ μΌλ° μ€ν λ¦¬μ§ κ³μ μ μ΅μ λ²μ μ
λλ€.
properties: { "supportsHttpsTrafficOnly": true }: μΆκ° μμ±μ μ§μ ν©λλ€. μ¬κΈ°μλ μ€ν λ¦¬μ§ κ³μ μμ HTTPS νΈλν½λ§ μ§μνλλ‘ μ€μ λμ΄ μμ΅λλ€.
az deployment group create \
--name addstorage \
--resource-group myResourceGroup \
--template-file $templateFile
μ΄μ ν¬νΈμμ myresourcegroupμ ν΄λ¦νλ©΄ μ€ν 리μ§κ° μΆκ°λ κ²μ νμΈν μ μμ΅λλ€.
κΈ°μ‘΄μ ν νλ¦Ώμ λ¬Έμ μ μ΄ ν κ°μ§ μμ΅λλ€.
κ·Έκ²μ nameμ΄ λ무 νλμ½λ©μ΄λΌλ μ μ
λλ€. μ΄ λΆλΆμ μμ ν΄λ³΄κ² μ΅λλ€.
μλμ μ½λμ²λΌ parametersλ₯Ό μΆκ°ν©μλ€.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageName": {
"type": "string",
"minLength": 3,
"maxLength": 24
}
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-09-01",
"name": "[parameters('storageName')]",
"location": "eastus",
"sku": {
"name": "Standard_LRS"
},
"kind": "StorageV2",
"properties": {
"supportsHttpsTrafficOnly": true
}
}
]
}
az deployment group create \
--name addnameparameter \
--resource-group myResourceGroup \
--template-file $templateFile \
--parameters storageName={your-unique-name}
μκΉ λ§λ€μ΄λμλ storageNameμ λ£μ΅λλ€.
(λΈλΌμΌ μμ΄ ""μμ΄ λ£μΌμλ©΄ λ©λλ€)