ディスクを作成または更新します。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}?api-version=2026-03-02
URI パラメーター
| 名前 |
/ |
必須 |
型 |
説明 |
|
diskName
|
path |
True
|
string
|
作成されるマネージド ディスクの名前。 ディスクの作成後に名前を変更することはできません。 名前でサポートされている文字は、a~z、A~Z、0~9、_ および -です。 名前の最大長は 80 文字です。
|
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
リソース グループの名前。 名前は大文字と小文字を区別しません。
|
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
ターゲット サブスクリプションの ID。
|
|
api-version
|
query |
True
|
string
minLength: 1
|
この操作に使用する API バージョン。
|
要求本文
| 名前 |
必須 |
型 |
説明 |
|
location
|
True
|
string
|
リソースが存在する地理的な場所
|
|
properties.creationData
|
True
|
CreationData
|
ディスク ソース情報。 ディスクの作成後に CreationData 情報を変更することはできません。
|
|
extendedLocation
|
|
ExtendedLocation
|
ディスクが作成される拡張された場所。 拡張された場所は変更できません。
|
|
properties.availabilityPolicy
|
|
AvailabilityPolicy
|
プラットフォームがディスク障害を処理する方法を決定します
|
|
properties.burstingEnabled
|
|
boolean
|
ディスクのプロビジョニングされたパフォーマンス ターゲットを超えるバーストを有効にするには、true に設定します。 バーストは既定で無効になっています。 Ultra ディスクには適用されません。
|
|
properties.completionPercent
|
|
number
(float)
|
CopyStart 操作を使用してリソースが作成されたときのバックグラウンド コピーの完了率。
|
|
properties.dataAccessAuthMode
|
|
DataAccessAuthMode
|
ディスクまたはスナップショットにエクスポートまたはアップロードするときの追加の認証要件。
|
|
properties.diskAccessId
|
|
string
|
ディスクでプライベート エンドポイントを使用するための DiskAccess リソースの ARM ID。
|
|
properties.diskIOPSReadOnly
|
|
integer
(int64)
|
共有ディスクを ReadOnly としてマウントしているすべての VM で許可される IOPS の合計数。 1 つの操作で 4k から 256k バイトの間で転送できます。
|
|
properties.diskIOPSReadWrite
|
|
integer
(int64)
|
このディスクで許可される IOPS の数。UltraSSD ディスクに対してのみ設定できます。 1 つの操作で 4k から 256k バイトの間で転送できます。
|
|
properties.diskMBpsReadOnly
|
|
integer
(int64)
|
共有ディスクを ReadOnly としてマウントしているすべての VM で許可される合計スループット (MBps)。 MBps は、1 秒あたり数百万バイトを意味します。ここでの MB では、10 の累乗の ISO 表記が使用されます。
|
|
properties.diskMBpsReadWrite
|
|
integer
(int64)
|
このディスクで許可される帯域幅。UltraSSD ディスクに対してのみ設定できます。 MBps は、1 秒あたり数百万バイトを意味します。ここでの MB では、10 の累乗の ISO 表記が使用されます。
|
|
properties.diskSizeGB
|
|
integer
(int32)
|
creationData.createOption が空の場合、このフィールドは必須であり、作成するディスクのサイズを示します。 このフィールドが他のオプションを使用して更新または作成するために存在する場合は、サイズ変更を示します。 サイズ変更は、ディスクが実行中の VM に接続されていない場合にのみ許可され、ディスクのサイズのみを増やすことができます。
|
|
properties.encryption
|
|
Encryption
|
Encryption プロパティを使用すると、保存データをカスタマー マネージド キーまたはプラットフォーム マネージド キーで暗号化できます。
|
|
properties.encryptionSettingsCollection
|
|
EncryptionSettingsCollection
|
Azure Disk Encryption に使用される暗号化設定コレクションには、ディスクまたはスナップショットごとに複数の暗号化設定を含めることができます。
|
|
properties.hyperVGeneration
|
|
HyperVGeneration
|
仮想マシンのハイパーバイザー生成。 OS ディスクにのみ適用されます。
|
|
properties.maxShares
|
|
integer
(int32)
|
ディスクに同時に接続できる VM の最大数。 1 より大きい値は、複数の VM に同時にマウントできるディスクを示します。
|
|
properties.networkAccessPolicy
|
|
NetworkAccessPolicy
|
ネットワーク経由でディスクにアクセスするためのポリシー。
|
|
properties.optimizedForFrequentAttach
|
|
boolean
|
このプロパティを true に設定すると、1 つの仮想マシンからデタッチして別の仮想マシンに接続することで、頻繁に (1 日に 5 回以上) データ ディスクの信頼性とパフォーマンスが向上します。 このプロパティは、ディスクが仮想マシンの障害ドメインと一致しなくなるため、デタッチされず、頻繁に接続されていないディスクには設定しないでください。
|
|
properties.osType
|
|
OperatingSystemTypes
|
オペレーティング システムの種類。
|
|
properties.publicNetworkAccess
|
|
PublicNetworkAccess
|
ディスク上のエクスポートを制御するためのポリシー。
|
|
properties.purchasePlan
|
|
DiskPurchasePlan
|
OS ディスクの作成元のイメージの購入プラン情報。 例: {name: 2019-Datacenter,publisher: MicrosoftWindowsServer, product: WindowsServer}
|
|
properties.securityProfile
|
|
DiskSecurityProfile
|
リソースのセキュリティ関連情報を格納します。
|
|
properties.supportedCapabilities
|
|
SupportedCapabilities
|
OS ディスクの作成元のイメージでサポートされている機能の一覧。
|
|
properties.supportsHibernation
|
|
boolean
|
ディスク上の OS が休止状態をサポートしているかどうかを示します。
|
|
properties.tier
|
|
string
|
ディスクのパフォーマンスレベル (P4、S10 など) は、https://azure.microsoft.com/en-us/pricing/details/managed-disks/します。 Ultra ディスクには適用されません。
|
|
sku
|
|
DiskSku
|
ディスク SKU 名。 Standard_LRS、Premium_LRS、StandardSSD_LRS、UltraSSD_LRS、Premium_ZRS、StandardSSD_ZRS、またはPremiumV2_LRSできます。
|
|
tags
|
|
object
|
リソース タグ。
|
|
zones
|
|
string[]
|
ディスクの論理ゾーンの一覧。
|
応答
| 名前 |
型 |
説明 |
|
200 OK
|
Disk
|
リソース 'Disk' の更新操作が成功しました
|
|
202 Accepted
|
Disk
|
要求は処理のために受け入れ済みですが、処理はまだ完了していません。
ヘッダー
- Location: string
- Retry-After: integer
|
|
Other Status Codes
|
CloudError
|
予期しないエラー応答。
|
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー。
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
| 名前 |
説明 |
|
user_impersonation
|
あなたのユーザー アカウントになりすます
|
例
create a confidential VM supported disk encrypted with customer managed key
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"osType": "Windows",
"securityProfile": {
"securityType": "ConfidentialVM_DiskEncryptedWithCustomerKey",
"secureVMDiskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"
}
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.DiskSecurityProfile;
import com.azure.resourcemanager.compute.models.DiskSecurityTypes;
import com.azure.resourcemanager.compute.models.ImageDiskReference;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json
*/
/**
* Sample code: create a confidential VM supported disk encrypted with customer managed key.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAConfidentialVMSupportedDiskEncryptedWithCustomerManagedKey(
com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("West US").withOsType(OperatingSystemTypes.WINDOWS)
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.FROM_IMAGE)
.withImageReference(new ImageDiskReference().withId(
"/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0")))
.withSecurityProfile(new DiskSecurityProfile()
.withSecurityType(DiskSecurityTypes.CONFIDENTIAL_VM_DISK_ENCRYPTED_WITH_CUSTOMER_KEY)
.withSecureVMDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_confidential_vm_supported_disk_encrypted_with_cmk.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"
},
},
"osType": "Windows",
"securityProfile": {
"secureVMDiskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
"securityType": "ConfidentialVM_DiskEncryptedWithCustomerKey",
},
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json
func ExampleDisksClient_BeginCreateOrUpdate_createAConfidentialVMSupportedDiskEncryptedWithCustomerManagedKey() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscriptionId}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
SecurityProfile: &armcompute.DiskSecurityProfile{
SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey),
SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"),
},
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
ImageReference: &armcompute.ImageDiskReference{
ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// SecurityProfile: &armcompute.DiskSecurityProfile{
// SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMDiskEncryptedWithCustomerKey),
// SecureVMDiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"),
// },
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// ImageReference: &armcompute.ImageDiskReference{
// ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json
*/
async function createAConfidentialVMSupportedDiskEncryptedWithCustomerManagedKey() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscriptionId}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
osType: "Windows",
securityProfile: {
securityType: "ConfidentialVM_DiskEncryptedWithCustomerKey",
secureVMDiskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}",
},
creationData: {
createOption: "FromImage",
imageReference: {
id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0",
},
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Succeeded",
"osType": "Windows",
"securityProfile": {
"securityType": "ConfidentialVM_DiskEncryptedWithCustomerKey",
"secureVMDiskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"
}
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"osType": "Windows",
"securityProfile": {
"securityType": "ConfidentialVM_DiskEncryptedWithCustomerKey",
"secureVMDiskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"
}
}
}
}
create a managed disk and associate with disk access resource.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"networkAccessPolicy": "AllowPrivate",
"diskAccessId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.NetworkAccessPolicy;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithDiskAccess.json
*/
/**
* Sample code: create a managed disk and associate with disk access resource.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskAndAssociateWithDiskAccessResource(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("West US").withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY))
.withDiskSizeGB(200).withNetworkAccessPolicy(NetworkAccessPolicy.ALLOW_PRIVATE).withDiskAccessId(
"/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_with_disk_access.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {"createOption": "Empty"},
"diskAccessId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}",
"diskSizeGB": 200,
"networkAccessPolicy": "AllowPrivate",
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithDiskAccess.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_WithDiskAccess.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskAndAssociateWithDiskAccessResource() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
},
DiskSizeGB: to.Ptr[int32](200),
NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowPrivate),
DiskAccessID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Succeeded"),
// NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowPrivate),
// DiskAccessID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"),
// PublicNetworkAccess: to.Ptr(armcompute.PublicNetworkAccessEnabled),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithDiskAccess.json
*/
async function createAManagedDiskAndAssociateWithDiskAccessResource() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: { createOption: "Empty" },
diskSizeGB: 200,
networkAccessPolicy: "AllowPrivate",
diskAccessId:
"/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Succeeded",
"networkAccessPolicy": "AllowPrivate",
"diskAccessId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}",
"publicNetworkAccess": "Enabled"
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
create a managed disk and associate with disk encryption set.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"encryption": {
"diskEncryptionSetId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.Encryption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithDiskEncryptionSet.json
*/
/**
* Sample code: create a managed disk and associate with disk encryption set.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskAndAssociateWithDiskEncryptionSet(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("West US").withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY))
.withDiskSizeGB(200)
.withEncryption(new Encryption().withDiskEncryptionSetId(
"/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_with_disk_encryption_set.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {"createOption": "Empty"},
"diskSizeGB": 200,
"encryption": {
"diskEncryptionSetId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"
},
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithDiskEncryptionSet.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_WithDiskEncryptionSet.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskAndAssociateWithDiskEncryptionSet() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
},
DiskSizeGB: to.Ptr[int32](200),
Encryption: &armcompute.Encryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Succeeded"),
// Encryption: &armcompute.Encryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"),
// },
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithDiskEncryptionSet.json
*/
async function createAManagedDiskAndAssociateWithDiskEncryptionSet() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: { createOption: "Empty" },
diskSizeGB: 200,
encryption: {
diskEncryptionSetId:
"/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}",
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Succeeded",
"encryption": {
"diskEncryptionSetId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"
}
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
create a managed disk by copying a snapshot.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ByCopyingASnapshot.json
*/
/**
* Sample code: create a managed disk by copying a snapshot.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskByCopyingASnapshot(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.COPY).withSourceResourceId(
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_by_copying_asnapshot.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot",
}
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ByCopyingASnapshot.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_ByCopyingASnapshot.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByCopyingASnapshot() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Updating"),
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
// SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ByCopyingASnapshot.json
*/
async function createAManagedDiskByCopyingASnapshot() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: {
createOption: "Copy",
sourceResourceId:
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot",
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot"
}
}
}
create a managed disk by importing an unmanaged blob from a different subscription.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Import",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json
*/
/**
* Sample code: create a managed disk by importing an unmanaged blob from a different subscription.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription(
com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.IMPORT).withStorageAccountId(
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount")
.withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_by_importing_blob_from_adifferent_subscription.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
}
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Updating"),
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
// StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
// SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json
*/
async function createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: {
createOption: "Import",
storageAccountId:
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "Import",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "Import",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
}
}
}
create a managed disk by importing an unmanaged blob from the same subscription.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json
*/
/**
* Sample code: create a managed disk by importing an unmanaged blob from the same subscription.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription(
com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.IMPORT)
.withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_by_importing_blob_from_the_same_subscription.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
}
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Updating"),
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
// SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json
*/
async function createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: {
createOption: "Import",
sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
}
}
}
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"osType": "Windows",
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"
}
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.ImageDiskReference;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAPlatformImage.json
*/
/**
* Sample code: create a managed disk from a platform image.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskFromAPlatformImage(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("West US").withOsType(OperatingSystemTypes.WINDOWS)
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.FROM_IMAGE)
.withImageReference(new ImageDiskReference().withId(
"/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"))),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_from_aplatform_image.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"
},
},
"osType": "Windows",
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAPlatformImage.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_FromAPlatformImage.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAPlatformImage() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscriptionId}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
ImageReference: &armcompute.ImageDiskReference{
ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
// PurchasePlan: &armcompute.DiskPurchasePlan{
// Name: to.Ptr("{sku}"),
// Publisher: to.Ptr("{publisher}"),
// Product: to.Ptr("{offer}"),
// },
// SupportedCapabilities: &armcompute.SupportedCapabilities{
// AcceleratedNetwork: to.Ptr(true),
// },
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// ImageReference: &armcompute.ImageDiskReference{
// ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAPlatformImage.json
*/
async function createAManagedDiskFromAPlatformImage() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscriptionId}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
osType: "Windows",
creationData: {
createOption: "FromImage",
imageReference: {
id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0",
},
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Succeeded",
"osType": "Windows",
"hyperVGeneration": "V1",
"purchasePlan": {
"name": "{sku}",
"publisher": "{publisher}",
"product": "{offer}"
},
"supportedCapabilities": {
"acceleratedNetwork": true
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"
}
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"purchasePlan": {
"name": "{sku}",
"publisher": "{publisher}",
"product": "{offer}"
},
"supportedCapabilities": {
"acceleratedNetwork": true
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"
}
},
"provisioningState": "Updating"
}
}
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"osType": "Windows",
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"communityGalleryImageId": "/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"
}
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.ImageDiskReference;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json
*/
/**
* Sample code: create a managed disk from an Azure Compute Gallery community image.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskFromAnAzureComputeGalleryCommunityImage(
com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US").withOsType(OperatingSystemTypes.WINDOWS)
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.FROM_IMAGE)
.withGalleryImageReference(new ImageDiskReference().withCommunityGalleryImageId(
"/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"))),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_from_an_azure_compute_gallery_community_image.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"communityGalleryImageId": "/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"
},
},
"osType": "Windows",
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryCommunityImage() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscriptionId}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
GalleryImageReference: &armcompute.ImageDiskReference{
CommunityGalleryImageID: to.Ptr("/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"),
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
// SupportedCapabilities: &armcompute.SupportedCapabilities{
// AcceleratedNetwork: to.Ptr(true),
// },
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// GalleryImageReference: &armcompute.ImageDiskReference{
// CommunityGalleryImageID: to.Ptr("/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json
*/
async function createAManagedDiskFromAnAzureComputeGalleryCommunityImage() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscriptionId}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
osType: "Windows",
creationData: {
createOption: "FromImage",
galleryImageReference: {
communityGalleryImageId:
"/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0",
},
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Succeeded",
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"acceleratedNetwork": true
},
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"communityGalleryImageId": "/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"
}
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"acceleratedNetwork": true
},
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"communityGalleryImageId": "/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0"
}
},
"provisioningState": "Updating"
}
}
create a managed disk from an Azure Compute Gallery direct shared image.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"osType": "Windows",
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"sharedGalleryImageId": "/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"
}
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.ImageDiskReference;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json
*/
/**
* Sample code: create a managed disk from an Azure Compute Gallery direct shared image.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage(
com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US").withOsType(OperatingSystemTypes.WINDOWS)
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.FROM_IMAGE)
.withGalleryImageReference(new ImageDiskReference().withSharedGalleryImageId(
"/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"))),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_from_an_azure_compute_gallery_direct_shared_image.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"sharedGalleryImageId": "/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"
},
},
"osType": "Windows",
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscriptionId}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
GalleryImageReference: &armcompute.ImageDiskReference{
SharedGalleryImageID: to.Ptr("/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"),
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
// SupportedCapabilities: &armcompute.SupportedCapabilities{
// AcceleratedNetwork: to.Ptr(true),
// },
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// GalleryImageReference: &armcompute.ImageDiskReference{
// SharedGalleryImageID: to.Ptr("/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json
*/
async function createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscriptionId}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
osType: "Windows",
creationData: {
createOption: "FromImage",
galleryImageReference: {
sharedGalleryImageId:
"/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0",
},
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Succeeded",
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"acceleratedNetwork": true
},
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"sharedGalleryImageId": "/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"
}
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"acceleratedNetwork": true
},
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"sharedGalleryImageId": "/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0"
}
},
"provisioningState": "Updating"
}
}
create a managed disk from an Azure Compute Gallery image.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"osType": "Windows",
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"id": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"
}
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.ImageDiskReference;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json
*/
/**
* Sample code: create a managed disk from an Azure Compute Gallery image.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskFromAnAzureComputeGalleryImage(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("West US").withOsType(OperatingSystemTypes.WINDOWS)
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.FROM_IMAGE)
.withGalleryImageReference(new ImageDiskReference().withId(
"/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"))),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_from_an_azure_compute_gallery_image.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"id": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"
},
},
"osType": "Windows",
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnAzureComputeGalleryImage() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscriptionId}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
GalleryImageReference: &armcompute.ImageDiskReference{
ID: to.Ptr("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"),
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
// SupportedCapabilities: &armcompute.SupportedCapabilities{
// AcceleratedNetwork: to.Ptr(true),
// SupportedSecurityOption: to.Ptr(armcompute.SupportedSecurityOptionTrustedLaunchSupported),
// },
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// GalleryImageReference: &armcompute.ImageDiskReference{
// ID: to.Ptr("/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json
*/
async function createAManagedDiskFromAnAzureComputeGalleryImage() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscriptionId}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
osType: "Windows",
creationData: {
createOption: "FromImage",
galleryImageReference: {
id: "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0",
},
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Succeeded",
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"acceleratedNetwork": true,
"supportedSecurityOption": "TrustedLaunchSupported"
},
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"id": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"
}
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"acceleratedNetwork": true,
"supportedSecurityOption": "TrustedLaunchSupported"
},
"creationData": {
"createOption": "FromImage",
"galleryImageReference": {
"id": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0"
}
},
"provisioningState": "Updating"
}
}
create a managed disk from an existing managed disk in the same or different subscription.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk2?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnExistingManagedDisk.json
*/
/**
* Sample code: create a managed disk from an existing managed disk in the same or different subscription.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription(
com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk2", new DiskInner()
.withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.COPY).withSourceResourceId(
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_from_an_existing_managed_disk.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk2",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1",
}
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnExistingManagedDisk.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_FromAnExistingManagedDisk.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk2", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
SourceResourceID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionCopy),
// SourceResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"),
// },
// ProvisioningState: to.Ptr("Updating"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnExistingManagedDisk.json
*/
async function createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk2", {
location: "West US",
creationData: {
createOption: "Copy",
sourceResourceId:
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1",
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk2"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Copy",
"sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk2"
}
create a managed disk from elastic san volume snapshot.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "CopyFromSanSnapshot",
"elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json
*/
/**
* Sample code: create a managed disk from elastic san volume snapshot.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskFromElasticSanVolumeSnapshot(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US").withCreationData(
new CreationData().withCreateOption(DiskCreateOption.COPY_FROM_SAN_SNAPSHOT).withElasticSanResourceId(
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot")),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_from_an_elastic_san_volume_snapshot.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "CopyFromSanSnapshot",
"elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot",
}
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromElasticSanVolumeSnapshot() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot),
ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionCopyFromSanSnapshot),
// ElasticSanResourceID: to.Ptr("subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json
*/
async function createAManagedDiskFromElasticSanVolumeSnapshot() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: {
createOption: "CopyFromSanSnapshot",
elasticSanResourceId:
"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot",
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "CopyFromSanSnapshot",
"elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"
},
"provisioningState": "Succeeded"
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "CopyFromSanSnapshot",
"elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
create a managed disk from ImportSecure create option
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"osType": "Windows",
"securityProfile": {
"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"
},
"creationData": {
"createOption": "ImportSecure",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.DiskSecurityProfile;
import com.azure.resourcemanager.compute.models.DiskSecurityTypes;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromImportSecure.json
*/
/**
* Sample code: create a managed disk from ImportSecure create option.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskFromImportSecureCreateOption(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("West US").withOsType(OperatingSystemTypes.WINDOWS)
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.IMPORT_SECURE).withStorageAccountId(
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount")
.withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")
.withSecurityDataUri("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"))
.withSecurityProfile(new DiskSecurityProfile()
.withSecurityType(DiskSecurityTypes.CONFIDENTIAL_VM_VMGUEST_STATE_ONLY_ENCRYPTED_WITH_PLATFORM_KEY)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_from_import_secure.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "ImportSecure",
"securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
},
"osType": "Windows",
"securityProfile": {"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"},
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromImportSecure.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_FromImportSecure.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromImportSecureCreateOption() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
SecurityProfile: &armcompute.DiskSecurityProfile{
SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey),
},
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure),
StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// SecurityProfile: &armcompute.DiskSecurityProfile{
// SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey),
// },
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure),
// StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
// SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
// SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromImportSecure.json
*/
async function createAManagedDiskFromImportSecureCreateOption() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
osType: "Windows",
securityProfile: { securityType: "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey" },
creationData: {
createOption: "ImportSecure",
storageAccountId:
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
securityDataUri: "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd",
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Succeeded",
"osType": "Windows",
"securityProfile": {
"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"
},
"creationData": {
"createOption": "ImportSecure",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"osType": "Windows",
"securityProfile": {
"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"
},
"creationData": {
"createOption": "ImportSecure",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"
}
}
}
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"osType": "Windows",
"securityProfile": {
"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"
},
"creationData": {
"createOption": "ImportSecure",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd",
"securityMetadataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.DiskSecurityProfile;
import com.azure.resourcemanager.compute.models.DiskSecurityTypes;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json
*/
/**
* Sample code: create a managed disk from ImportSecure create option with metadata URI for Confidential VM.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskFromImportSecureCreateOptionWithMetadataURIForConfidentialVM(
com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("West US").withOsType(OperatingSystemTypes.WINDOWS)
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.IMPORT_SECURE).withStorageAccountId(
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount")
.withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")
.withSecurityDataUri("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd")
.withSecurityMetadataUri("https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd"))
.withSecurityProfile(new DiskSecurityProfile()
.withSecurityType(DiskSecurityTypes.CONFIDENTIAL_VM_VMGUEST_STATE_ONLY_ENCRYPTED_WITH_PLATFORM_KEY)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_from_import_secure_with_vm_metadata.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {
"createOption": "ImportSecure",
"securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd",
"securityMetadataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
},
"osType": "Windows",
"securityProfile": {"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"},
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromImportSecureCreateOptionWithMetadataUriForConfidentialVM() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
SecurityProfile: &armcompute.DiskSecurityProfile{
SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey),
},
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure),
StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"),
SecurityMetadataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// SecurityProfile: &armcompute.DiskSecurityProfile{
// SecurityType: to.Ptr(armcompute.DiskSecurityTypesConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey),
// },
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionImportSecure),
// StorageAccountID: to.Ptr("subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"),
// SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
// SecurityDataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd"),
// SecurityMetadataURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json
*/
async function createAManagedDiskFromImportSecureCreateOptionWithMetadataURIForConfidentialVM() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
osType: "Windows",
securityProfile: { securityType: "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey" },
creationData: {
createOption: "ImportSecure",
storageAccountId:
"subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
securityDataUri: "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd",
securityMetadataUri: "https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd",
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Updating",
"osType": "Windows",
"securityProfile": {
"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"
},
"creationData": {
"createOption": "ImportSecure",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd",
"securityMetadataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd"
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "West US",
"properties": {
"provisioningState": "Succeeded",
"osType": "Windows",
"securityProfile": {
"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"
},
"creationData": {
"createOption": "ImportSecure",
"storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
"securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd",
"securityMetadataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd"
}
}
}
create a managed disk from UploadPreparedSecure create option
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"osType": "Windows",
"securityProfile": {
"securityType": "TrustedLaunch"
},
"creationData": {
"createOption": "UploadPreparedSecure",
"uploadSizeBytes": 10737418752
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.DiskSecurityProfile;
import com.azure.resourcemanager.compute.models.DiskSecurityTypes;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromUploadPreparedSecure.json
*/
/**
* Sample code: create a managed disk from UploadPreparedSecure create option.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskFromUploadPreparedSecureCreateOption(
com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US").withOsType(OperatingSystemTypes.WINDOWS)
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.UPLOAD_PREPARED_SECURE)
.withUploadSizeBytes(10737418752L))
.withSecurityProfile(new DiskSecurityProfile().withSecurityType(DiskSecurityTypes.TRUSTED_LAUNCH)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_from_upload_prepared_secure.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {"createOption": "UploadPreparedSecure", "uploadSizeBytes": 10737418752},
"osType": "Windows",
"securityProfile": {"securityType": "TrustedLaunch"},
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromUploadPreparedSecure.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_FromUploadPreparedSecure.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskFromUploadPreparedSecureCreateOption() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
SecurityProfile: &armcompute.DiskSecurityProfile{
SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
},
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionUploadPreparedSecure),
UploadSizeBytes: to.Ptr[int64](10737418752),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// SecurityProfile: &armcompute.DiskSecurityProfile{
// SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
// },
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionUploadPreparedSecure),
// UploadSizeBytes: to.Ptr[int64](10737418752),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_FromUploadPreparedSecure.json
*/
async function createAManagedDiskFromUploadPreparedSecureCreateOption() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
osType: "Windows",
securityProfile: { securityType: "TrustedLaunch" },
creationData: { createOption: "UploadPreparedSecure", uploadSizeBytes: 10737418752 },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"osType": "Windows",
"securityProfile": {
"securityType": "TrustedLaunch"
},
"creationData": {
"createOption": "UploadPreparedSecure",
"uploadSizeBytes": 10737418752
},
"provisioningState": "Succeeded"
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"osType": "Windows",
"securityProfile": {
"securityType": "TrustedLaunch"
},
"creationData": {
"createOption": "UploadPreparedSecure",
"uploadSizeBytes": 10737418752
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
create a managed disk with availability policy.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 1024,
"availabilityPolicy": {
"actionOnDiskDelay": "AutomaticReattach"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.AvailabilityPolicy;
import com.azure.resourcemanager.compute.models.AvailabilityPolicyDiskDelay;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json
*/
/**
* Sample code: create a managed disk with availability policy.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskWithAvailabilityPolicy(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)).withDiskSizeGB(1024)
.withAvailabilityPolicy(
new AvailabilityPolicy().withActionOnDiskDelay(AvailabilityPolicyDiskDelay.AUTOMATIC_REATTACH)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_or_update_availability_policy.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"availabilityPolicy": {"actionOnDiskDelay": "AutomaticReattach"},
"creationData": {"createOption": "Empty"},
"diskSizeGB": 1024,
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithAvailabilityPolicy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
},
DiskSizeGB: to.Ptr[int32](1024),
AvailabilityPolicy: &armcompute.AvailabilityPolicy{
ActionOnDiskDelay: to.Ptr(armcompute.AvailabilityPolicyDiskDelayAutomaticReattach),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](1024),
// AvailabilityPolicy: &armcompute.AvailabilityPolicy{
// ActionOnDiskDelay: to.Ptr(armcompute.AvailabilityPolicyDiskDelayAutomaticReattach),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json
*/
async function createAManagedDiskWithAvailabilityPolicy() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: { createOption: "Empty" },
diskSizeGB: 1024,
availabilityPolicy: { actionOnDiskDelay: "AutomaticReattach" },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 1024,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 1024,
"availabilityPolicy": {
"actionOnDiskDelay": "AutomaticReattach"
},
"provisioningState": "Succeeded"
},
"location": "West US",
"name": "myDisk"
}
create a managed disk with dataAccessAuthMode
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"dataAccessAuthMode": "AzureActiveDirectory"
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DataAccessAuthMode;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithDataAccessAuthMode.json
*/
/**
* Sample code: create a managed disk with dataAccessAuthMode.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskWithDataAccessAuthMode(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)).withDiskSizeGB(200)
.withDataAccessAuthMode(DataAccessAuthMode.AZURE_ACTIVE_DIRECTORY),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_with_data_access_auth_mode.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {"createOption": "Empty"},
"dataAccessAuthMode": "AzureActiveDirectory",
"diskSizeGB": 200,
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithDataAccessAuthMode.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_WithDataAccessAuthMode.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithDataAccessAuthMode() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
},
DiskSizeGB: to.Ptr[int32](200),
DataAccessAuthMode: to.Ptr(armcompute.DataAccessAuthModeAzureActiveDirectory),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Succeeded"),
// DataAccessAuthMode: to.Ptr(armcompute.DataAccessAuthModeAzureActiveDirectory),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithDataAccessAuthMode.json
*/
async function createAManagedDiskWithDataAccessAuthMode() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: { createOption: "Empty" },
diskSizeGB: 200,
dataAccessAuthMode: "AzureActiveDirectory",
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Succeeded",
"dataAccessAuthMode": "AzureActiveDirectory"
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
create a managed disk with optimizedForFrequentAttach.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"optimizedForFrequentAttach": true
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json
*/
/**
* Sample code: create a managed disk with optimizedForFrequentAttach.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskWithOptimizedForFrequentAttach(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)).withDiskSizeGB(200)
.withOptimizedForFrequentAttach(true),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_with_optimized_for_frequent_attach.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {
"creationData": {"createOption": "Empty"},
"diskSizeGB": 200,
"optimizedForFrequentAttach": True,
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithOptimizedForFrequentAttach() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
},
DiskSizeGB: to.Ptr[int32](200),
OptimizedForFrequentAttach: to.Ptr(true),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Succeeded"),
// OptimizedForFrequentAttach: to.Ptr(true),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json
*/
async function createAManagedDiskWithOptimizedForFrequentAttach() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: { createOption: "Empty" },
diskSizeGB: 200,
optimizedForFrequentAttach: true,
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Succeeded",
"optimizedForFrequentAttach": true
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating",
"optimizedForFrequentAttach": true
},
"location": "West US",
"name": "myDisk"
}
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Upload",
"performancePlus": true
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_PerformancePlus.json
*/
/**
* Sample code: create a managed disk with performancePlus.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskWithPerformancePlus(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US").withCreationData(
new CreationData().withCreateOption(DiskCreateOption.UPLOAD).withPerformancePlus(true)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_performance_plus.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {"creationData": {"createOption": "Upload", "performancePlus": True}},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_PerformancePlus.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_PerformancePlus.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithPerformancePlus() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload),
PerformancePlus: to.Ptr(true),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload),
// PerformancePlus: to.Ptr(true),
// },
// ProvisioningState: to.Ptr("Updating"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_PerformancePlus.json
*/
async function createAManagedDiskWithPerformancePlus() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: { createOption: "Upload", performancePlus: true },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Upload",
"performancePlus": true
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Upload",
"performancePlus": true
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
create a managed disk with premium v2 account type.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myPremiumV2Disk?api-version=2026-03-02
{
"location": "West US",
"sku": {
"name": "PremiumV2_LRS"
},
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"diskIOPSReadWrite": 125,
"diskMBpsReadWrite": 3000
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.DiskSku;
import com.azure.resourcemanager.compute.models.DiskStorageAccountTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json
*/
/**
* Sample code: create a managed disk with premium v2 account type.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskWithPremiumV2AccountType(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myPremiumV2Disk",
new DiskInner().withLocation("West US")
.withSku(new DiskSku().withName(DiskStorageAccountTypes.PREMIUM_V2_LRS))
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)).withDiskSizeGB(200)
.withDiskIopsReadWrite(125L).withDiskMBpsReadWrite(3000L),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_with_premium_v2_lrsaccount_type.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myPremiumV2Disk",
disk={
"location": "West US",
"properties": {
"creationData": {"createOption": "Empty"},
"diskIOPSReadWrite": 125,
"diskMBpsReadWrite": 3000,
"diskSizeGB": 200,
},
"sku": {"name": "PremiumV2_LRS"},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithPremiumV2AccountType() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myPremiumV2Disk", armcompute.Disk{
Location: to.Ptr("West US"),
SKU: &armcompute.DiskSKU{
Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS),
},
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
},
DiskSizeGB: to.Ptr[int32](200),
DiskIOPSReadWrite: to.Ptr[int64](125),
DiskMBpsReadWrite: to.Ptr[int64](3000),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Updating"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myPremiumV2Disk"),
// SKU: &armcompute.DiskSKU{
// Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumV2LRS),
// Tier: to.Ptr("Premium"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json
*/
async function createAManagedDiskWithPremiumV2AccountType() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myPremiumV2Disk", {
location: "West US",
sku: { name: "PremiumV2_LRS" },
creationData: { createOption: "Empty" },
diskSizeGB: 200,
diskIopsReadWrite: 125,
diskMBpsReadWrite: 3000,
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myPremiumV2Disk",
"sku": {
"name": "PremiumV2_LRS",
"tier": "Premium"
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myPremiumV2Disk",
"sku": {
"name": "PremiumV2_LRS",
"tier": "Premium"
}
}
create a managed disk with security profile
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "North Central US",
"properties": {
"osType": "Windows",
"securityProfile": {
"securityType": "TrustedLaunch"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"
}
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.DiskSecurityProfile;
import com.azure.resourcemanager.compute.models.DiskSecurityTypes;
import com.azure.resourcemanager.compute.models.ImageDiskReference;
import com.azure.resourcemanager.compute.models.OperatingSystemTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithSecurityProfile.json
*/
/**
* Sample code: create a managed disk with security profile.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskWithSecurityProfile(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk", new DiskInner()
.withLocation("North Central US").withOsType(OperatingSystemTypes.WINDOWS)
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.FROM_IMAGE)
.withImageReference(new ImageDiskReference().withId(
"/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}")))
.withSecurityProfile(new DiskSecurityProfile().withSecurityType(DiskSecurityTypes.TRUSTED_LAUNCH)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_with_security_profile.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "North Central US",
"properties": {
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"
},
},
"osType": "Windows",
"securityProfile": {"securityType": "TrustedLaunch"},
},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithSecurityProfile.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_WithSecurityProfile.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithSecurityProfile() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("North Central US"),
Properties: &armcompute.DiskProperties{
OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
SecurityProfile: &armcompute.DiskSecurityProfile{
SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
},
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
ImageReference: &armcompute.ImageDiskReference{
ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"),
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("North Central US"),
// Properties: &armcompute.DiskProperties{
// ProvisioningState: to.Ptr("Succeeded"),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// SecurityProfile: &armcompute.DiskSecurityProfile{
// SecurityType: to.Ptr(armcompute.DiskSecurityTypesTrustedLaunch),
// },
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// ImageReference: &armcompute.ImageDiskReference{
// ID: to.Ptr("/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithSecurityProfile.json
*/
async function createAManagedDiskWithSecurityProfile() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "North Central US",
osType: "Windows",
securityProfile: { securityType: "TrustedLaunch" },
creationData: {
createOption: "FromImage",
imageReference: {
id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}",
},
},
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "North Central US",
"properties": {
"provisioningState": "Succeeded",
"osType": "Windows",
"securityProfile": {
"securityType": "TrustedLaunch"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"
}
}
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"name": "myDisk",
"location": "North Central US",
"properties": {
"provisioningState": "Updating",
"osType": "Windows",
"securityProfile": {
"securityType": "TrustedLaunch"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"
}
}
}
}
create a managed disk with ssd zrs account type.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"sku": {
"name": "Premium_ZRS"
},
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.DiskSku;
import com.azure.resourcemanager.compute.models.DiskStorageAccountTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithSSDZRSAccountType.json
*/
/**
* Sample code: create a managed disk with ssd zrs account type.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAManagedDiskWithSsdZrsAccountType(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US").withSku(new DiskSku().withName(DiskStorageAccountTypes.PREMIUM_ZRS))
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)).withDiskSizeGB(200),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_with_ssdzrs_account_type.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {"creationData": {"createOption": "Empty"}, "diskSizeGB": 200},
"sku": {"name": "Premium_ZRS"},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithSSDZRSAccountType.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_WithSSDZRSAccountType.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithSsdZrsAccountType() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
SKU: &armcompute.DiskSKU{
Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS),
},
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
},
DiskSizeGB: to.Ptr[int32](200),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Updating"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// SKU: &armcompute.DiskSKU{
// Name: to.Ptr(armcompute.DiskStorageAccountTypesPremiumZRS),
// Tier: to.Ptr("Premium"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithSSDZRSAccountType.json
*/
async function createAManagedDiskWithSsdZrsAccountType() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
sku: { name: "Premium_ZRS" },
creationData: { createOption: "Empty" },
diskSizeGB: 200,
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk",
"sku": {
"name": "Premium_ZRS",
"tier": "Premium"
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk",
"sku": {
"name": "Premium_ZRS",
"tier": "Premium"
}
}
create a managed disk with ultra account type with readOnly property set.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myUltraReadOnlyDisk?api-version=2026-03-02
{
"location": "West US",
"sku": {
"name": "UltraSSD_LRS"
},
"properties": {
"creationData": {
"createOption": "Empty",
"logicalSectorSize": 4096
},
"diskSizeGB": 200,
"diskIOPSReadWrite": 125,
"diskMBpsReadWrite": 3000,
"encryption": {
"type": "EncryptionAtRestWithPlatformKey"
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.DiskSku;
import com.azure.resourcemanager.compute.models.DiskStorageAccountTypes;
import com.azure.resourcemanager.compute.models.Encryption;
import com.azure.resourcemanager.compute.models.EncryptionType;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json
*/
/**
* Sample code: create a managed disk with ultra account type with readOnly property set.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet(
com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myUltraReadOnlyDisk", new DiskInner()
.withLocation("West US").withSku(new DiskSku().withName(DiskStorageAccountTypes.ULTRA_SSD_LRS))
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY).withLogicalSectorSize(4096))
.withDiskSizeGB(200).withDiskIopsReadWrite(125L).withDiskMBpsReadWrite(3000L)
.withEncryption(new Encryption().withType(EncryptionType.ENCRYPTION_AT_REST_WITH_PLATFORM_KEY)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_with_ultra_ssd_read_only.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myUltraReadOnlyDisk",
disk={
"location": "West US",
"properties": {
"creationData": {"createOption": "Empty", "logicalSectorSize": 4096},
"diskIOPSReadWrite": 125,
"diskMBpsReadWrite": 3000,
"diskSizeGB": 200,
"encryption": {"type": "EncryptionAtRestWithPlatformKey"},
},
"sku": {"name": "UltraSSD_LRS"},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myUltraReadOnlyDisk", armcompute.Disk{
Location: to.Ptr("West US"),
SKU: &armcompute.DiskSKU{
Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
},
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
LogicalSectorSize: to.Ptr[int32](4096),
},
DiskSizeGB: to.Ptr[int32](200),
DiskIOPSReadWrite: to.Ptr[int64](125),
DiskMBpsReadWrite: to.Ptr[int64](3000),
Encryption: &armcompute.Encryption{
Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Updating"),
// Encryption: &armcompute.Encryption{
// Type: to.Ptr(armcompute.EncryptionTypeEncryptionAtRestWithPlatformKey),
// },
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myUltraReadOnlyDisk"),
// SKU: &armcompute.DiskSKU{
// Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
// Tier: to.Ptr("Ultra"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json
*/
async function createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myUltraReadOnlyDisk", {
location: "West US",
sku: { name: "UltraSSD_LRS" },
creationData: { createOption: "Empty", logicalSectorSize: 4096 },
diskSizeGB: 200,
diskIopsReadWrite: 125,
diskMBpsReadWrite: 3000,
encryption: { type: "EncryptionAtRestWithPlatformKey" },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating",
"encryption": {
"type": "EncryptionAtRestWithPlatformKey"
}
},
"location": "West US",
"name": "myUltraReadOnlyDisk",
"sku": {
"name": "UltraSSD_LRS",
"tier": "Ultra"
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myUltraReadOnlyDisk",
"sku": {
"name": "UltraSSD_LRS",
"tier": "Ultra"
}
}
create a managed upload disk.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Upload",
"uploadSizeBytes": 10737418752
}
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_UploadDisk.json
*/
/**
* Sample code: create a managed upload disk.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAManagedUploadDisk(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US").withCreationData(
new CreationData().withCreateOption(DiskCreateOption.UPLOAD).withUploadSizeBytes(10737418752L)),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_upload_disk.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {"creationData": {"createOption": "Upload", "uploadSizeBytes": 10737418752}},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_UploadDisk.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_UploadDisk.json
func ExampleDisksClient_BeginCreateOrUpdate_createAManagedUploadDisk() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload),
UploadSizeBytes: to.Ptr[int64](10737418752),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionUpload),
// UploadSizeBytes: to.Ptr[int64](10737418752),
// },
// ProvisioningState: to.Ptr("Updating"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_UploadDisk.json
*/
async function createAManagedUploadDisk() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: { createOption: "Upload", uploadSizeBytes: 10737418752 },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Upload",
"uploadSizeBytes": 10737418752
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Upload",
"uploadSizeBytes": 10737418752
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
create an empty managed disk in extended location.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"extendedLocation": {
"type": "EdgeZone",
"name": "{edge-zone-id}"
},
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.ExtendedLocation;
import com.azure.resourcemanager.compute.models.ExtendedLocationTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_InExtendedLocation.json
*/
/**
* Sample code: create an empty managed disk in extended location.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAnEmptyManagedDiskInExtendedLocation(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US")
.withExtendedLocation(
new ExtendedLocation().withName("{edge-zone-id}").withType(ExtendedLocationTypes.EDGE_ZONE))
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)).withDiskSizeGB(200),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_in_extended_location.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"extendedLocation": {"name": "{edge-zone-id}", "type": "EdgeZone"},
"location": "West US",
"properties": {"creationData": {"createOption": "Empty"}, "diskSizeGB": 200},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_InExtendedLocation.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_InExtendedLocation.json
func ExampleDisksClient_BeginCreateOrUpdate_createAnEmptyManagedDiskInExtendedLocation() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
ExtendedLocation: &armcompute.ExtendedLocation{
Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone),
Name: to.Ptr("{edge-zone-id}"),
},
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
},
DiskSizeGB: to.Ptr[int32](200),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Updating"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// ExtendedLocation: &armcompute.ExtendedLocation{
// Type: to.Ptr(armcompute.ExtendedLocationTypesEdgeZone),
// Name: to.Ptr("{edge-zone-id}"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_InExtendedLocation.json
*/
async function createAnEmptyManagedDiskInExtendedLocation() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
extendedLocation: { type: "EdgeZone", name: "{edge-zone-id}" },
creationData: { createOption: "Empty" },
diskSizeGB: 200,
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk",
"extendedLocation": {
"type": "EdgeZone",
"name": "{edge-zone-id}"
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk",
"extendedLocation": {
"type": "EdgeZone",
"name": "{edge-zone-id}"
}
}
create an empty managed disk.
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_Empty.json
*/
/**
* Sample code: create an empty managed disk.
*
* @param manager Entry point to ComputeManager.
*/
public static void createAnEmptyManagedDisk(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US")
.withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)).withDiskSizeGB(200),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_empty.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"location": "West US", "properties": {"creationData": {"createOption": "Empty"}, "diskSizeGB": 200}},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_Empty.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_Empty.json
func ExampleDisksClient_BeginCreateOrUpdate_createAnEmptyManagedDisk() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
},
DiskSizeGB: to.Ptr[int32](200),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Updating"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_Empty.json
*/
async function createAnEmptyManagedDisk() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
creationData: { createOption: "Empty" },
diskSizeGB: 200,
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
create an ultra managed disk with logicalSectorSize 512E
要求のサンプル
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2026-03-02
{
"location": "West US",
"sku": {
"name": "UltraSSD_LRS"
},
"properties": {
"creationData": {
"createOption": "Empty",
"logicalSectorSize": 512
},
"diskSizeGB": 200
}
}
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.CreationData;
import com.azure.resourcemanager.compute.models.DiskCreateOption;
import com.azure.resourcemanager.compute.models.DiskSku;
import com.azure.resourcemanager.compute.models.DiskStorageAccountTypes;
/**
* Samples for Disks CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithLogicalSectorSize.json
*/
/**
* Sample code: create an ultra managed disk with logicalSectorSize 512E.
*
* @param manager Entry point to ComputeManager.
*/
public static void
createAnUltraManagedDiskWithLogicalSectorSize512E(com.azure.resourcemanager.compute.ComputeManager manager) {
manager.serviceClient().getDisks().createOrUpdate("myResourceGroup", "myDisk",
new DiskInner().withLocation("West US")
.withSku(new DiskSku().withName(DiskStorageAccountTypes.ULTRA_SSD_LRS))
.withCreationData(
new CreationData().withCreateOption(DiskCreateOption.EMPTY).withLogicalSectorSize(512))
.withDiskSizeGB(200),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_create_with_logical_sector_size.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.disks.begin_create_or_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"location": "West US",
"properties": {"creationData": {"createOption": "Empty", "logicalSectorSize": 512}, "diskSizeGB": 200},
"sku": {"name": "UltraSSD_LRS"},
},
).result()
print(response)
# x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithLogicalSectorSize.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v8"
)
// Generated from example definition: 2026-03-02/diskExamples/Disk_Create_WithLogicalSectorSize.json
func ExampleDisksClient_BeginCreateOrUpdate_createAnUltraManagedDiskWithLogicalSectorSize512E() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewDisksClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myDisk", armcompute.Disk{
Location: to.Ptr("West US"),
SKU: &armcompute.DiskSKU{
Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
},
Properties: &armcompute.DiskProperties{
CreationData: &armcompute.CreationData{
CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
LogicalSectorSize: to.Ptr[int32](512),
},
DiskSizeGB: to.Ptr[int32](200),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armcompute.DisksClientCreateOrUpdateResponse{
// Disk: armcompute.Disk{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// LogicalSectorSize: to.Ptr[int32](512),
// },
// DiskSizeGB: to.Ptr[int32](200),
// ProvisioningState: to.Ptr("Updating"),
// },
// Location: to.Ptr("West US"),
// Name: to.Ptr("myDisk"),
// SKU: &armcompute.DiskSKU{
// Name: to.Ptr(armcompute.DiskStorageAccountTypesUltraSSDLRS),
// Tier: to.Ptr("Ultra"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates a disk.
*
* @summary creates or updates a disk.
* x-ms-original-file: 2026-03-02/diskExamples/Disk_Create_WithLogicalSectorSize.json
*/
async function createAnUltraManagedDiskWithLogicalSectorSize512E() {
const credential = new DefaultAzureCredential();
const subscriptionId = "{subscription-id}";
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", {
location: "West US",
sku: { name: "UltraSSD_LRS" },
creationData: { createOption: "Empty", logicalSectorSize: 512 },
diskSizeGB: 200,
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty",
"logicalSectorSize": 512
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk",
"sku": {
"name": "UltraSSD_LRS",
"tier": "Ultra"
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk",
"properties": {
"creationData": {
"createOption": "Empty",
"logicalSectorSize": 512
},
"diskSizeGB": 200,
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk",
"sku": {
"name": "UltraSSD_LRS",
"tier": "Ultra"
}
}
定義
ApiError
Object
API エラー。
| 名前 |
型 |
説明 |
|
code
|
string
|
エラー コード。
|
|
details
|
ApiErrorBase[]
|
Api エラーの詳細
|
|
innererror
|
InnerError
|
Api 内部エラー
|
|
message
|
string
|
エラー メッセージ。
|
|
target
|
string
|
特定のエラーのターゲット。
|
ApiErrorBase
Object
API エラーベース。
| 名前 |
型 |
説明 |
|
code
|
string
|
エラー コード。
|
|
message
|
string
|
エラー メッセージ。
|
|
target
|
string
|
特定のエラーのターゲット。
|
Architecture
列挙
OS ディスクでサポートされている CPU アーキテクチャ。
AvailabilityPolicy
Object
データ ディスクの可用性または接続に問題がある場合は、VM の動作を指定します
AvailabilityPolicyDiskDelay
列挙
I/O が遅いディスクの処理方法を決定します。
| 値 |
説明 |
|
None
|
既定では、av ポリシーが指定されていない場合の動作 (低速ディスク io 時に VM が再起動されます) になります。
|
|
AutomaticReattach
|
ディスク io に障害が発生した場合、または応答が遅い場合は、ディスクをデタッチしてから再度アタッチしてみてください。
|
CloudError
Object
コンピューティング サービスからのエラー応答。
ConfidentialVMVersion
列挙
リソースの機密VMのバージョンを示します。
| 値 |
説明 |
|
V1
|
V1はリソースに仮想マシンのメタデータが伴わないことを示します。
|
|
V2
|
V2はリソースに仮想マシンのメタデータが関連付けられていることを示します。
|
createdByType
列挙
リソースを作成した ID の種類。
| 値 |
説明 |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
CreationData
Object
ディスクの作成時に使用されるデータ。
| 名前 |
型 |
説明 |
|
createOption
|
DiskCreateOption
|
これにより、ディスクの作成に使用できるソースが列挙されます。
|
|
elasticSanResourceId
|
string
|
createOption が CopyFromSanSnapshot の場合は必須。 これは、ソースエラスティック SAN ボリューム スナップショットの ARM ID です。
|
|
galleryImageReference
|
ImageDiskReference
|
ギャラリー イメージから作成する場合に必要です。 ImageDiskReference の id/sharedGalleryImageId/communityGalleryImageId は、ディスクの作成元となる共有ギャラリー イメージ バージョンの ARM ID になります。
|
|
imageReference
|
ImageDiskReference
|
PIR またはユーザー イメージのディスク ソース情報。
|
|
instantAccessDurationMinutes
|
integer
(int64)
minimum: 1
|
Premium SSD v2 または Ultra Disk から作成されたスナップショットの場合、このプロパティは、スナップショットが即時アクセスのために保持される時間を分単位で決定し、より高速な復元を可能にします。
|
|
logicalSectorSize
|
integer
(int32)
|
Ultra ディスクの論理セクター サイズ (バイト単位)。 サポートされている値は 512 ad 4096 です。 4096 が既定値です。
|
|
performancePlus
|
boolean
|
このフラグを true に設定すると、デプロイされたディスクのパフォーマンス ターゲットが向上します。それぞれのパフォーマンス ターゲットについては、こちらを参照してください。 このフラグは、ディスク作成時にのみ設定でき、有効にした後は無効にできません。
|
|
provisionedBandwidthCopySpeed
|
ProvisionedBandwidthCopyOption
|
このフィールドがスナップショットに設定され、createOption が CopyStart の場合、スナップショットはより迅速にコピーされます。
|
|
securityDataUri
|
string
|
createOption が ImportSecure の場合、これは VM ゲスト状態にインポートされる BLOB の URI です。
|
|
securityMetadataUri
|
string
(uri)
|
createOption が ImportSecure の場合、これは Confidential VM の VM メタデータにインポートされる BLOB の URI です。
|
|
sourceResourceId
|
string
|
createOption が Copy の場合、これはソース スナップショットまたはディスクの ARM ID です。
|
|
sourceUniqueId
|
string
|
このフィールドが設定されている場合、これはこのリソースのソースを識別する一意の ID です。
|
|
sourceUri
|
string
|
createOption が Import の場合、これはマネージド ディスクにインポートされる BLOB の URI です。
|
|
storageAccountId
|
string
|
createOption が Import の場合は必須。 ディスクとしてインポートする BLOB を含むストレージ アカウントの Azure Resource Manager 識別子。
|
|
uploadSizeBytes
|
integer
(int64)
|
createOption が Upload の場合、これは VHD フッターを含むアップロードの内容のサイズです。 この値は、20972032 (VHD フッターの場合は 20 MiB + 512 バイト) と35183298347520 バイト (VHD フッターの場合は 32 TiB + 512 バイト) の間である必要があります。
|
DataAccessAuthMode
列挙
ディスクまたはスナップショットにエクスポートまたはアップロードするときの追加の認証要件。
| 値 |
説明 |
|
AzureActiveDirectory
|
エクスポート/アップロード URL を使用すると、ユーザーがAzure Active Directoryに ID を持ち、データのエクスポート/アップロードに必要なアクセス許可を持っているかどうかがシステムによって確認されます。 aka.ms/DisksAzureADAuth を参照してください。
|
|
None
|
エクスポート/アップロード URL にアクセスするときに、追加の認証は実行されません。
|
Disk
Object
ディスク リソース。
| 名前 |
型 |
説明 |
|
extendedLocation
|
ExtendedLocation
|
ディスクが作成される拡張された場所。 拡張された場所は変更できません。
|
|
id
|
string
|
リソースの完全修飾リソース ID。 例 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
location
|
string
|
リソースが存在する地理的な場所
|
|
managedBy
|
string
|
ディスクが接続されている VM の ID を含む相対 URI。
|
|
managedByExtended
|
string[]
|
ディスクが接続されている VM の ID を含む相対 URI の一覧。 maxShares は、ディスクを複数の VM に接続できるように、ディスクの 1 より大きい値に設定する必要があります。
|
|
name
|
string
|
リソースの名前
|
|
properties.LastOwnershipUpdateTime
|
string
(date-time)
|
ディスクの所有権状態が最後に変更された UTC 時刻、つまり、ディスクが最後に VM に接続またはデタッチされた時刻、またはディスクが接続された VM の割り当てが解除または起動された時刻。
|
|
properties.availabilityPolicy
|
AvailabilityPolicy
|
プラットフォームがディスク障害を処理する方法を決定します
|
|
properties.burstingEnabled
|
boolean
|
ディスクのプロビジョニングされたパフォーマンス ターゲットを超えるバーストを有効にするには、true に設定します。 バーストは既定で無効になっています。 Ultra ディスクには適用されません。
|
|
properties.burstingEnabledTime
|
string
(date-time)
|
ディスクでバーストが最後に有効になった最新の時刻。
|
|
properties.completionPercent
|
number
(float)
|
CopyStart 操作を使用してリソースが作成されたときのバックグラウンド コピーの完了率。
|
|
properties.creationData
|
CreationData
|
ディスク ソース情報。 ディスクの作成後に CreationData 情報を変更することはできません。
|
|
properties.dataAccessAuthMode
|
DataAccessAuthMode
|
ディスクまたはスナップショットにエクスポートまたはアップロードするときの追加の認証要件。
|
|
properties.diskAccessId
|
string
|
ディスクでプライベート エンドポイントを使用するための DiskAccess リソースの ARM ID。
|
|
properties.diskIOPSReadOnly
|
integer
(int64)
|
共有ディスクを ReadOnly としてマウントしているすべての VM で許可される IOPS の合計数。 1 つの操作で 4k から 256k バイトの間で転送できます。
|
|
properties.diskIOPSReadWrite
|
integer
(int64)
|
このディスクで許可される IOPS の数。UltraSSD ディスクに対してのみ設定できます。 1 つの操作で 4k から 256k バイトの間で転送できます。
|
|
properties.diskMBpsReadOnly
|
integer
(int64)
|
共有ディスクを ReadOnly としてマウントしているすべての VM で許可される合計スループット (MBps)。 MBps は、1 秒あたり数百万バイトを意味します。ここでの MB では、10 の累乗の ISO 表記が使用されます。
|
|
properties.diskMBpsReadWrite
|
integer
(int64)
|
このディスクで許可される帯域幅。UltraSSD ディスクに対してのみ設定できます。 MBps は、1 秒あたり数百万バイトを意味します。ここでの MB では、10 の累乗の ISO 表記が使用されます。
|
|
properties.diskSizeBytes
|
integer
(int64)
|
ディスクのサイズ (バイト単位)。 このフィールドは読み取り専用です。
|
|
properties.diskSizeGB
|
integer
(int32)
|
creationData.createOption が空の場合、このフィールドは必須であり、作成するディスクのサイズを示します。 このフィールドが他のオプションを使用して更新または作成するために存在する場合は、サイズ変更を示します。 サイズ変更は、ディスクが実行中の VM に接続されていない場合にのみ許可され、ディスクのサイズのみを増やすことができます。
|
|
properties.diskState
|
DiskState
|
ディスクの状態。
|
|
properties.encryption
|
Encryption
|
Encryption プロパティを使用すると、保存データをカスタマー マネージド キーまたはプラットフォーム マネージド キーで暗号化できます。
|
|
properties.encryptionSettingsCollection
|
EncryptionSettingsCollection
|
Azure Disk Encryption に使用される暗号化設定コレクションには、ディスクまたはスナップショットごとに複数の暗号化設定を含めることができます。
|
|
properties.hyperVGeneration
|
HyperVGeneration
|
仮想マシンのハイパーバイザー生成。 OS ディスクにのみ適用されます。
|
|
properties.maxShares
|
integer
(int32)
|
ディスクに同時に接続できる VM の最大数。 1 より大きい値は、複数の VM に同時にマウントできるディスクを示します。
|
|
properties.networkAccessPolicy
|
NetworkAccessPolicy
|
ネットワーク経由でディスクにアクセスするためのポリシー。
|
|
properties.optimizedForFrequentAttach
|
boolean
|
このプロパティを true に設定すると、1 つの仮想マシンからデタッチして別の仮想マシンに接続することで、頻繁に (1 日に 5 回以上) データ ディスクの信頼性とパフォーマンスが向上します。 このプロパティは、ディスクが仮想マシンの障害ドメインと一致しなくなるため、デタッチされず、頻繁に接続されていないディスクには設定しないでください。
|
|
properties.osType
|
OperatingSystemTypes
|
オペレーティング システムの種類。
|
|
properties.propertyUpdatesInProgress
|
PropertyUpdatesInProgress
|
更新が保留中のディスクのプロパティ。
|
|
properties.provisioningState
|
string
|
ディスク のプロビジョニング状態。
|
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
ディスク上のエクスポートを制御するためのポリシー。
|
|
properties.purchasePlan
|
DiskPurchasePlan
|
OS ディスクの作成元のイメージの購入プラン情報。 例: {name: 2019-Datacenter,publisher: MicrosoftWindowsServer, product: WindowsServer}
|
|
properties.securityProfile
|
DiskSecurityProfile
|
リソースのセキュリティ関連情報を格納します。
|
|
properties.shareInfo
|
ShareInfoElement[]
|
ディスクが接続されているすべての VM のリストの詳細。 maxShares は、ディスクを複数の VM に接続できるように、ディスクの 1 より大きい値に設定する必要があります。
|
|
properties.supportedCapabilities
|
SupportedCapabilities
|
OS ディスクの作成元のイメージでサポートされている機能の一覧。
|
|
properties.supportsHibernation
|
boolean
|
ディスク上の OS が休止状態をサポートしているかどうかを示します。
|
|
properties.tier
|
string
|
ディスクのパフォーマンスレベル (P4、S10 など) は、https://azure.microsoft.com/en-us/pricing/details/managed-disks/します。 Ultra ディスクには適用されません。
|
|
properties.timeCreated
|
string
(date-time)
|
ディスクが作成された時刻。
|
|
properties.uniqueId
|
string
|
リソースを識別する一意の Guid。
|
|
sku
|
DiskSku
|
ディスク SKU 名。 Standard_LRS、Premium_LRS、StandardSSD_LRS、UltraSSD_LRS、Premium_ZRS、StandardSSD_ZRS、またはPremiumV2_LRSできます。
|
|
systemData
|
systemData
|
createdBy および modifiedBy 情報を含む Azure Resource Manager メタデータ。
|
|
tags
|
object
|
リソース タグ。
|
|
type
|
string
|
リソースの種類。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts"
|
|
zones
|
string[]
|
ディスクの論理ゾーンの一覧。
|
DiskCreateOption
列挙
これにより、ディスクの作成に使用できるソースが列挙されます。
| 値 |
説明 |
|
Empty
|
diskSizeGB によって指定されたサイズの空のデータ ディスクを作成します。
|
|
Attach
|
ディスクは VM に接続されます。
|
|
FromImage
|
指定された imageReference または galleryImageReference で指定されたプラットフォーム イメージから新しいディスクを作成します。
|
|
Import
|
storageAccountId で指定されたストレージ アカウント内の sourceUri で指定された BLOB からインポートして、ディスクを作成します。
|
|
Copy
|
指定された sourceResourceId で指定されたディスクまたはスナップショットからコピーして、新しいディスクまたはスナップショットを作成します。
|
|
Restore
|
バックアップ回復ポイントからコピーして、新しいディスクを作成します。
|
|
Upload
|
書き込みトークンを取得し、それを使用してディスクの内容を直接アップロードすることで、新しいディスクを作成します。
|
|
CopyStart
|
ディープ コピー プロセスを使用して新しいディスクを作成します。リソースの作成は、ソースからすべてのデータがコピーされた後でのみ完了と見なされます。
|
|
ImportSecure
|
[作成のインポート] オプションに似ています。 securityDataUri で指定された VM ゲスト状態と securityMetadataUri で指定された VM メタデータの追加の BLOB を、storageAccountId で指定されたストレージ アカウントにインポートして、新しいトラステッド起動 VM または機密 VM でサポートされているディスクを作成します。 VM メタデータはオプションであり、特定の機密 VM 構成にのみ必要であり、トラステッド起動 VM には必要ありません。
|
|
UploadPreparedSecure
|
[作成のアップロード] オプションに似ています。 新しいトラステッド起動 VM または機密 VM でサポートされているディスクを作成し、ディスク、VM ゲストの状態、および VM メタデータの書き込みトークンを使用してアップロードします。 VM メタデータはオプションであり、特定の機密 VM 構成にのみ必要であり、トラステッド起動 VM には必要ありません。
|
|
CopyFromSanSnapshot
|
エラスティック SAN ボリューム スナップショットからエクスポートして新しいディスクを作成する
|
DiskPurchasePlan
Object
MarketPlace を通じてサード パーティの成果物の購入コンテキストを確立するために使用されます。
| 名前 |
型 |
説明 |
|
name
|
string
|
プラン ID。
|
|
product
|
string
|
マーケットプレースからのイメージの製品を指定します。 これは、imageReference 要素の下の Offer と同じ値です。
|
|
promotionCode
|
string
|
オファープロモーションコード。
|
|
publisher
|
string
|
発行元 ID。
|
DiskSecurityProfile
Object
リソースのセキュリティ関連情報を格納します。
| 名前 |
型 |
説明 |
|
confidentialVMVersion
|
ConfidentialVMVersion
|
リソースの機密VMのバージョンを示します。
|
|
secureVMDiskEncryptionSetId
|
string
|
機密 VM に関連付けられているディスク暗号化セットの ResourceId は、カスタマー マネージド キーで暗号化されています
|
|
securityType
|
DiskSecurityTypes
|
VM の SecurityType を指定します。 OS ディスクにのみ適用されます。
|
DiskSecurityTypes
列挙
VM の SecurityType を指定します。 OS ディスクにのみ適用されます。
| 値 |
説明 |
|
TrustedLaunch
|
トラステッド起動では、セキュア ブートや仮想トラステッド プラットフォーム モジュール (vTPM) などのセキュリティ機能が提供されます
|
|
ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey
|
VM ゲスト状態のみが暗号化された機密 VM ディスクを示します
|
|
ConfidentialVM_DiskEncryptedWithPlatformKey
|
OS ディスクと VM ゲスト状態の両方がプラットフォーム マネージド キーで暗号化された機密 VM ディスクを示します
|
|
ConfidentialVM_DiskEncryptedWithCustomerKey
|
OS ディスクと VM ゲスト状態の両方がカスタマー マネージド キーで暗号化された機密 VM ディスクを示します
|
|
ConfidentialVM_NonPersistedTPM
|
一時的な vTPM を持つ機密 VM ディスクを示します。 vTPM 状態は、VM の再起動後も保持されません。
|
DiskSku
Object
ディスク SKU 名。 Standard_LRS、Premium_LRS、StandardSSD_LRS、UltraSSD_LRS、Premium_ZRS、StandardSSD_ZRS、またはPremiumV2_LRSできます。
DiskState
列挙
これにより、ディスクの可能な状態が列挙されます。
| 値 |
説明 |
|
Unattached
|
ディスクが使用されていないため、VM に接続できます。
|
|
Attached
|
ディスクは現在、実行中の VM に接続されています。
|
|
Reserved
|
ディスクは、停止して割り当て解除された VM に接続されます。
|
|
Frozen
|
ディスクは、休止状態の VM に接続されています。
|
|
ActiveSAS
|
現在、ディスクにはアクティブな SAS URI が関連付けられています。
|
|
ActiveSASFrozen
|
ディスクは休止状態の VM に接続され、アクティブな SAS URI が関連付けられています。
|
|
ReadyToUpload
|
書き込みトークンを要求することで、ディスクをアップロードして作成する準備ができました。
|
|
ActiveUpload
|
アップロード用のディスクが作成され、アップロード用の書き込みトークンが発行されました。
|
DiskStorageAccountTypes
列挙
SKU 名。
| 値 |
説明 |
|
Standard_LRS
|
Standard HDD のローカル冗長ストレージ。 バックアップ、重要でない、頻度の低いアクセスに最適です。
|
|
Premium_LRS
|
Premium SSD のローカル冗長ストレージ。 運用環境とパフォーマンスに依存するワークロードに最適です。
|
|
StandardSSD_LRS
|
Standard SSD のローカル冗長ストレージ。 Web サーバー、軽く使用されるエンタープライズ アプリケーション、開発/テストに最適です。
|
|
UltraSSD_LRS
|
Ultra SSD のローカル冗長ストレージ。 SAP HANA、最上位層データベース (SQL、Oracle など)、その他のトランザクション負荷の高いワークロードなどの IO 集中型ワークロードに最適です。
|
|
Premium_ZRS
|
Premium SSD ゾーン冗長ストレージ。 ゾーン障害に対するストレージの回復性を必要とする運用ワークロードに最適です。
|
|
StandardSSD_ZRS
|
Standard SSD ゾーン冗長ストレージ。 Web サーバー、軽量に使用されるエンタープライズ アプリケーション、およびゾーン障害に対するストレージの回復性を必要とする開発/テストに最適です。
|
|
PremiumV2_LRS
|
Premium SSD v2 ローカル冗長ストレージ。 低待機時間と高い IOPS とスループットを一貫して必要とする運用環境とパフォーマンスに依存するワークロードに最適です。
|
Encryption
Object
ディスクまたはスナップショットの保存時の暗号化設定
| 名前 |
型 |
説明 |
|
diskEncryptionSetId
|
string
|
保存時の暗号化を有効にするために使用するディスク暗号化セットの ResourceId。
|
|
type
|
EncryptionType
|
ディスクのデータを暗号化するために使用されるキーの種類。
|
EncryptionSettingsCollection
Object
ディスクまたはスナップショットの暗号化設定
| 名前 |
型 |
説明 |
|
enabled
|
boolean
|
このフラグを true に設定し、DiskEncryptionKey とオプションの KeyEncryptionKey を指定して暗号化を有効にします。 このフラグを false に設定し、DiskEncryptionKey と KeyEncryptionKey を削除して暗号化を無効にします。 要求オブジェクトで EncryptionSettings が null の場合、既存の設定は変更されません。
|
|
encryptionSettings
|
EncryptionSettingsElement[]
|
暗号化設定のコレクション。ディスク ボリュームごとに 1 つ。
|
|
encryptionSettingsVersion
|
string
|
ディスクに使用される暗号化の種類について説明します。 このフィールドを設定すると、上書きできません。 '1.0' は、AAD アプリを使用した Azure Disk Encryption に対応しています。'1.1' は Azure Disk Encryption に対応しています。
|
EncryptionSettingsElement
Object
1 つのディスク ボリュームの暗号化設定。
EncryptionType
列挙
ディスクのデータを暗号化するために使用されるキーの種類。
| 値 |
説明 |
|
EncryptionAtRestWithPlatformKey
|
ディスクは、プラットフォーム マネージド キーを使用して保存時に暗号化されます。 既定の暗号化の種類です。 これは、ディスク暗号化セットの有効な暗号化の種類ではありません。
|
|
EncryptionAtRestWithCustomerKey
|
ディスクは、顧客が変更および取り消すことができるカスタマー マネージド キーを使用して保存時に暗号化されます。
|
|
EncryptionAtRestWithPlatformAndCustomerKeys
|
ディスクは保存時に 2 層の暗号化で暗号化されます。 キーの 1 つはカスタマー マネージドで、もう 1 つのキーはプラットフォーム管理です。
|
ExtendedLocation
Object
拡張された場所の複合型。
ExtendedLocationTypes
列挙
拡張された場所の種類。
HyperVGeneration
列挙
仮想マシンのハイパーバイザー生成。 OS ディスクにのみ適用されます。
ImageDiskReference
Object
ディスクの作成に使用されるソース イメージ。
| 名前 |
型 |
説明 |
|
communityGalleryImageId
|
string
|
コミュニティの Azure コンピューティング ギャラリー イメージ参照を含む相対 URI。
|
|
id
|
string
|
プラットフォーム イメージ リポジトリ、ユーザー イメージ、または Azure コンピューティング ギャラリー イメージ参照を含む相対 URI。
|
|
lun
|
integer
(int32)
|
ディスクがイメージのデータ ディスクから作成された場合、これはイメージ内のどのデータ ディスクを使用するかを示すインデックスです。 OS ディスクの場合、このフィールドは null です。
|
|
sharedGalleryImageId
|
string
|
直接共有 Azure コンピューティング ギャラリー イメージ参照を含む相対 URI。
|
InnerError
Object
内部エラーの詳細。
| 名前 |
型 |
説明 |
|
errordetail
|
string
|
内部エラー メッセージまたは例外ダンプ。
|
|
exceptiontype
|
string
|
例外の種類。
|
KeyVaultAndKeyReference
Object
Key Vault Key Url と KeK のコンテナー ID は省略可能であり、指定されている場合は encryptionKey のラップを解除するために使用されます
| 名前 |
型 |
説明 |
|
keyUrl
|
string
|
KeyVault のキーまたはシークレットを指す URL
|
|
sourceVault
|
SourceVault
|
キーまたはシークレットを含む KeyVault のリソース ID
|
KeyVaultAndSecretReference
Object
暗号化キーの Key Vault シークレット URL とコンテナー ID
| 名前 |
型 |
説明 |
|
secretUrl
|
string
|
KeyVault のキーまたはシークレットを指す URL
|
|
sourceVault
|
SourceVault
|
キーまたはシークレットを含む KeyVault のリソース ID
|
NetworkAccessPolicy
列挙
ネットワーク経由でディスクにアクセスするためのポリシー。
| 値 |
説明 |
|
AllowAll
|
ディスクは、任意のネットワークからエクスポートまたはアップロードできます。
|
|
AllowPrivate
|
ディスクは、DiskAccess リソースのプライベート エンドポイントを使用してエクスポートまたはアップロードできます。
|
|
DenyAll
|
ディスクをエクスポートできません。
|
OperatingSystemTypes
列挙
オペレーティング システムの種類。
PropertyUpdatesInProgress
Object
更新が保留中のディスクのプロパティ。
| 名前 |
型 |
説明 |
|
targetTier
|
string
|
層変更操作が進行中の場合のディスクのターゲット・パフォーマンス層。
|
ProvisionedBandwidthCopyOption
列挙
このフィールドがスナップショットに設定され、createOption が CopyStart の場合、スナップショットはより迅速にコピーされます。
PublicNetworkAccess
列挙
ディスク上のエクスポートを制御するためのポリシー。
| 値 |
説明 |
|
Enabled
|
NetworkAccessPolicy が AllowAll に設定されている場合は、SAS URI を生成して、インターネット上のディスクの基になるデータにパブリックにアクセスできます。 NetworkAccessPolicy が AllowPrivate に設定されている場合は、信頼された Azure VNET からのみ SAS URI を介してデータにアクセスできます。
|
|
Disabled
|
NetworkAccessPolicy が AllowAll に設定されている場合でも、インターネット上のディスクの基になるデータにパブリックにアクセスすることはできません。 NetworkAccessPolicy が AllowPrivate に設定されている場合は、信頼された Azure VNET からのみ SAS URI を介してデータにアクセスできます。
|
ShareInfoElement
Object
| 名前 |
型 |
説明 |
|
vmUri
|
string
|
ディスクが接続されている VM の ID を含む相対 URI。
|
SourceVault
Object
コンテナー ID は、/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} という形式の Azure Resource Manager リソース ID です。
| 名前 |
型 |
説明 |
|
id
|
string
|
リソース ID
|
SupportedCapabilities
Object
VM で使用するためにディスク リソースに保持されるサポートされている機能の一覧。
| 名前 |
型 |
説明 |
|
acceleratedNetwork
|
boolean
|
TRUE の 場合は、OS ディスクの作成元のイメージが高速ネットワークをサポートしています。
|
|
architecture
|
Architecture
|
OS ディスクでサポートされている CPU アーキテクチャ。
|
|
diskControllerTypes
|
string
|
OS ディスクがサポートするディスク コントローラー。 設定する場合は、SCSI、SCSI、NVME、NVME、SCSI を使用できます。
|
|
supportedSecurityOption
|
SupportedSecurityOption
|
トラステッド起動またはコンフィデンシャル VM の作成にサポートされているディスクのセキュリティ機能を指します
|
SupportedSecurityOption
列挙
トラステッド起動またはコンフィデンシャル VM の作成にサポートされているディスクのセキュリティ機能を指します
| 値 |
説明 |
|
TrustedLaunchSupported
|
ディスクは、トラステッド起動 VM の作成をサポートしています。
|
|
TrustedLaunchAndConfidentialVMSupported
|
このディスクは、トラステッド起動と機密の両方の VM の作成をサポートしています。
|
systemData
Object
リソースの作成と最後の変更に関連するメタデータ。
| 名前 |
型 |
説明 |
|
createdAt
|
string
(date-time)
|
リソース作成のタイムスタンプ (UTC)。
|
|
createdBy
|
string
|
リソースを作成した ID。
|
|
createdByType
|
createdByType
|
リソースを作成した ID の種類。
|
|
lastModifiedAt
|
string
(date-time)
|
リソースの最終変更のタイムスタンプ (UTC)
|
|
lastModifiedBy
|
string
|
リソースを最後に変更した ID。
|
|
lastModifiedByType
|
createdByType
|
リソースを最後に変更した ID の種類。
|