Azure 仮想マシン ライブラリAzure virtual machine libraries

概要Overview

Linux または Windows を実行するオンデマンドのスケーラブルなコンピューティング リソースです。On-demand, scalable computing resources running Linux or Windows.

Azure 仮想マシンの概要については、「Azure Portal で Linux 仮想マシンを作成する」を参照してください。To get started with Azure Virtual Machines, see Create a Linux virtual machine with the Azure portal.

管理 APIManagement API

Azure の Windows 仮想マシンと Linux 仮想マシンは、コードから Management API を使って作成、構成、管理、スケーリングを行えます。Create, configure, manage and scale Windows and Linux virtual machines in Azure from your code with the management API.

pip を使ってライブラリをインストールします。Install the library via pip.

pip install azure-mgmt-compute

Example

管理対象のサービス ID (MSI) 認証を使って既存の Azure リソース グループに新しい Linux 仮想マシンを作成します。Create a new Linux virtual machine in an existing Azure resource group with Managed Service Identity(MSI) authentication.

VM_PARAMETERS={
        'location': 'LOCATION',
        'os_profile': {
            'computer_name': 'VM_NAME',
            'admin_username': 'USERNAME',
            'admin_password': 'PASSWORD'
        },
        'hardware_profile': {
            'vm_size': 'Standard_DS1_v2'
        },
        'storage_profile': {
            'image_reference': {
                'publisher': 'Canonical',
                'offer': 'UbuntuServer',
                'sku': '16.04.0-LTS',
                'version': 'latest'
            },
        },
        'network_profile': {
            'network_interfaces': [{
                'id': 'NIC_ID',
            }]
        },
    }

def create_vm()
    compute_client.virtual_machines.create_or_update(
        'RESOURCE_GROUP_NAME', 'VM_NAME', VM_PARAMETERS)

サンプルSamples

仮想マシン サンプルの完全な一覧をご覧ください。View the complete list of virtual machine samples.