https://www.pulumi.com/registry/packages/azure-native/api-docs/sql/database/
Python: 3.9.13
-- 1. macにPulumiインストール
brew install pulumi/tap/pulumi
-- 2. Azureログイン
az login --use-device-code
az account show
az version
az configure --list-defaults
az configure --defaults location=japaneast
az configure --list-defaults
az group list
az upgrade
-- 3. Create new project
mkdir test
cd test
pulumi new azure-python
Japan East
japaneast
↑locationはどちらの表記でもOK
az account list-locations --output table
pulumi config get azure-native:location
pulumi config set azure-native:location japaneast
pulumi config get azure-native:location
vim __main__.py
import pulumi
import pulumi_azure_native as azure_native
rg9999999 = azure_native.resources.ResourceGroup("rg9999999",
resource_group_name="rg9999999")
import pulumi
import pulumi_azure_native as azure_native
server99999999 = azure_native.sql.Server("server99999999",
administrator_login="azureuser",
administrator_login_password="passwordpassword",
public_network_access="Enabled",
resource_group_name="rg9999999",
version="12.0",
server_name="server99999999")
fw01 = azure_native.sql.FirewallRule("fw01",
firewall_rule_name="fw01",
resource_group_name="rg9999999",
server_name="server99999999",
start_ip_address="192.0.2.1",
end_ip_address="192.0.2.1")
db99999999 = azure_native.sql.Database("db99999999",
database_name="db99999999",
resource_group_name="rg9999999",
server_name="server99999999",
license_type="LicenseIncluded",
collation="Japanese_BIN2",
sku=azure_native.sql.SkuArgs(
name="Basic",
))
-- 4. pulumi 実行
pulumi up
※依存性を考慮してデプロイされない
az sql server list \
--resource-group rg9999999
az sql server firewall-rule list \
--resource-group rg9999999 \
--server server99999999
az sql db list \
--resource-group rg9999999 \
--server server99999999
sqlcmd -U azureuser -S server99999999.database.windows.net -d db99999999
-- 5. Azureクリーンアップ
pulumi destroy
pulumi stack rm dev --force