Tworzy lub aktualizuje dysk.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}?api-version=2026-03-02
Parametry identyfikatora URI
| Nazwisko |
W |
Wymagane |
Typ |
Opis |
|
diskName
|
path |
True
|
string
|
Nazwa tworzonego dysku zarządzanego. Nie można zmienić nazwy po utworzeniu dysku. Obsługiwane znaki dla nazwy to a-z, A-Z, 0-9, _ i -. Maksymalna długość nazwy to 80 znaków.
|
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Nazwa grupy zasobów. Nazwa jest niewrażliwa na wielkość liter.
|
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
Identyfikator subskrypcji docelowej.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Wersja interfejsu API do użycia dla tej operacji.
|
Treść żądania
| Nazwisko |
Wymagane |
Typ |
Opis |
|
location
|
True
|
string
|
Lokalizacja geograficzna, w której znajduje się zasób
|
|
properties.creationData
|
True
|
CreationData
|
Informacje o źródle dysku. Nie można zmienić informacji creationData po utworzeniu dysku.
|
|
extendedLocation
|
|
ExtendedLocation
|
Lokalizacja rozszerzona, w której zostanie utworzony dysk. Nie można zmienić lokalizacji rozszerzonej.
|
|
properties.availabilityPolicy
|
|
AvailabilityPolicy
|
Określa, jak platforma traktuje awarie dysku
|
|
properties.burstingEnabled
|
|
boolean
|
Ustaw wartość true, aby włączyć zwiększenie wydajności poza aprowizowaną wartość docelową wydajności dysku. "Wyburzanie jest domyślnie wyłączone." Nie dotyczy dysków w warstwie Ultra.
|
|
properties.completionPercent
|
|
number
(float)
|
Procent wykonania kopii w tle po utworzeniu zasobu za pomocą operacji CopyStart.
|
|
properties.dataAccessAuthMode
|
|
DataAccessAuthMode
|
Dodatkowe wymagania dotyczące uwierzytelniania podczas eksportowania lub przekazywania do dysku lub migawki.
|
|
properties.diskAccessId
|
|
string
|
Identyfikator usługi ARM zasobu DiskAccess do używania prywatnych punktów końcowych na dyskach.
|
|
properties.diskIOPSReadOnly
|
|
integer
(int64)
|
Całkowita liczba operacji we/wy na sekundę, która będzie dozwolona na wszystkich maszynach wirtualnych instalowania dysku udostępnionego jako ReadOnly. Jedna operacja może przesyłać od 4k do 256 tys. bajtów.
|
|
properties.diskIOPSReadWrite
|
|
integer
(int64)
|
Liczba operacji we/wy na sekundę dozwolonych dla tego dysku; można ustawić tylko dla dysków UltraSSD. Jedna operacja może przesyłać od 4k do 256 tys. bajtów.
|
|
properties.diskMBpsReadOnly
|
|
integer
(int64)
|
Łączna przepływność (MB/s), która będzie dozwolona na wszystkich maszynach wirtualnych instalowania dysku udostępnionego jako ReadOnly. Mb/s oznacza miliony bajtów na sekundę - MB w tym miejscu używa notacji ISO, mocy 10.
|
|
properties.diskMBpsReadWrite
|
|
integer
(int64)
|
Dozwolona przepustowość dla tego dysku; można ustawić tylko dla dysków UltraSSD. Mb/s oznacza miliony bajtów na sekundę - MB w tym miejscu używa notacji ISO, mocy 10.
|
|
properties.diskSizeGB
|
|
integer
(int32)
|
Jeśli parametr creationData.createOption jest pusty, to pole jest obowiązkowe i wskazuje rozmiar dysku do utworzenia. Jeśli to pole jest obecne w przypadku aktualizacji lub tworzenia z innymi opcjami, oznacza to zmianę rozmiaru. Zmiany rozmiaru są dozwolone tylko wtedy, gdy dysk nie jest dołączony do uruchomionej maszyny wirtualnej i może zwiększyć tylko rozmiar dysku.
|
|
properties.encryption
|
|
Encryption
|
Właściwość szyfrowania może służyć do szyfrowania danych magazynowanych przy użyciu kluczy zarządzanych przez klienta lub kluczy zarządzanych przez platformę.
|
|
properties.encryptionSettingsCollection
|
|
EncryptionSettingsCollection
|
Kolekcja ustawień szyfrowania używana dla usługi Azure Disk Encryption może zawierać wiele ustawień szyfrowania na dysk lub migawkę.
|
|
properties.hyperVGeneration
|
|
HyperVGeneration
|
Generacja hypervisora maszyny wirtualnej. Dotyczy tylko dysków systemu operacyjnego.
|
|
properties.maxShares
|
|
integer
(int32)
|
Maksymalna liczba maszyn wirtualnych, które mogą być dołączane do dysku w tym samym czasie. Wartość większa niż jedna wskazuje dysk, który można instalować na wielu maszynach wirtualnych jednocześnie.
|
|
properties.networkAccessPolicy
|
|
NetworkAccessPolicy
|
Zasady uzyskiwania dostępu do dysku za pośrednictwem sieci.
|
|
properties.optimizedForFrequentAttach
|
|
boolean
|
Ustawienie tej właściwości na wartość true zwiększa niezawodność i wydajność dysków danych, które są często (więcej niż 5 razy dziennie) przez odłączenie od jednej maszyny wirtualnej i dołączone do innej. Ta właściwość nie powinna być ustawiana dla dysków, które nie są odłączone i dołączone często, ponieważ powoduje, że dyski nie są zgodne z domeną błędów maszyny wirtualnej.
|
|
properties.osType
|
|
OperatingSystemTypes
|
Typ systemu operacyjnego.
|
|
properties.publicNetworkAccess
|
|
PublicNetworkAccess
|
Zasady kontrolowania eksportu na dysku.
|
|
properties.purchasePlan
|
|
DiskPurchasePlan
|
Informacje o planie zakupu obrazu, z którego utworzono dysk systemu operacyjnego. Np. — {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}
|
|
properties.securityProfile
|
|
DiskSecurityProfile
|
Zawiera informacje dotyczące zabezpieczeń zasobu.
|
|
properties.supportedCapabilities
|
|
SupportedCapabilities
|
Lista obsługiwanych możliwości obrazu, z którego utworzono dysk systemu operacyjnego.
|
|
properties.supportsHibernation
|
|
boolean
|
Wskazuje system operacyjny na dysku obsługuje hibernacji.
|
|
properties.tier
|
|
string
|
Warstwa wydajności dysku (np. P4, S10), jak opisano tutaj: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Nie dotyczy dysków w warstwie Ultra.
|
|
sku
|
|
DiskSku
|
Nazwa jednostki SKU dysków. Można Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS lub PremiumV2_LRS.
|
|
tags
|
|
object
|
Tagi zasobów.
|
|
zones
|
|
string[]
|
Lista Strefa logiczna dla dysku.
|
Odpowiedzi
| Nazwisko |
Typ |
Opis |
|
200 OK
|
Disk
|
Operacja aktualizacji zasobu "Dysk" powiodła się
|
|
202 Accepted
|
Disk
|
Żądanie zostało zaakceptowane do przetwarzania, ale przetwarzanie nie zostało jeszcze ukończone.
Nagłówki
- Location: string
- Retry-After: integer
|
|
Other Status Codes
|
CloudError
|
Nieoczekiwana odpowiedź na błąd.
|
Zabezpieczenia
azure_auth
Przepływ OAuth2 w usłudze Azure Active Directory.
Typ:
oauth2
Flow:
implicit
Adres URL autoryzacji:
https://login.microsoftonline.com/common/oauth2/authorize
Zakresy
| Nazwisko |
Opis |
|
user_impersonation
|
podszywaj się pod konto użytkownika
|
Przykłady
create a confidential VM supported disk encrypted with customer managed key
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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"
}
}
}
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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"
}
}
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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"
}
}
}
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
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
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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"
}
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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.
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
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/v9"
)
// 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
Przykładowa odpowiedź
{
"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"
}
}
Definicje
| Nazwisko |
Opis |
|
ApiError
|
Błąd interfejsu API.
|
|
ApiErrorBase
|
Baza błędów interfejsu API.
|
|
Architecture
|
Architektura procesora CPU obsługiwana przez dysk systemu operacyjnego.
|
|
AvailabilityPolicy
|
W przypadku problemu z dostępnością lub łącznością z dyskiem danych określ zachowanie maszyny wirtualnej
|
|
AvailabilityPolicyDiskDelay
|
Określa sposób obsługi dysków z wolnymi wejściami / wyjściami.
|
|
CloudError
|
Odpowiedź na błąd z usługi Obliczeniowej.
|
|
ConfidentialVMVersion
|
Wskazuje wersję Confidential VM dla danego zasobu.
|
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
|
CreationData
|
Dane używane podczas tworzenia dysku.
|
|
DataAccessAuthMode
|
Dodatkowe wymagania dotyczące uwierzytelniania podczas eksportowania lub przekazywania do dysku lub migawki.
|
|
Disk
|
Zasób dysku.
|
|
DiskCreateOption
|
Wylicza to możliwe źródła tworzenia dysku.
|
|
DiskPurchasePlan
|
Służy do ustanawiania kontekstu zakupu dowolnego artefaktu innej firmy za pośrednictwem platformy MarketPlace.
|
|
DiskSecurityProfile
|
Zawiera informacje dotyczące zabezpieczeń zasobu.
|
|
DiskSecurityTypes
|
Określa typ zabezpieczeń maszyny wirtualnej. Dotyczy tylko dysków systemu operacyjnego.
|
|
DiskSku
|
Nazwa jednostki SKU dysków. Można Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS lub PremiumV2_LRS.
|
|
DiskState
|
Spowoduje to wyliczenie możliwego stanu dysku.
|
|
DiskStorageAccountTypes
|
Nazwa SKU.
|
|
Encryption
|
Szyfrowanie ustawień magazynowanych dla dysku lub migawki
|
|
EncryptionSettingsCollection
|
Ustawienia szyfrowania dysku lub migawki
|
|
EncryptionSettingsElement
|
Ustawienia szyfrowania dla jednego woluminu dysku.
|
|
EncryptionType
|
Typ klucza używanego do szyfrowania danych dysku.
|
|
ExtendedLocation
|
Typ złożony lokalizacji rozszerzonej.
|
|
ExtendedLocationTypes
|
Typ lokalizacji rozszerzonej.
|
|
HyperVGeneration
|
Generacja hypervisora maszyny wirtualnej. Dotyczy tylko dysków systemu operacyjnego.
|
|
ImageDiskReference
|
Obraz źródłowy używany do tworzenia dysku.
|
|
InnerError
|
Szczegóły błędu wewnętrznego.
|
|
KeyVaultAndKeyReference
|
Adres URL klucza usługi Key Vault i identyfikator magazynu keK jest opcjonalny, a jeśli jest on używany do odpakowywania klucza szyfrowania
|
|
KeyVaultAndSecretReference
|
Adres URL wpisu tajnego usługi Key Vault i identyfikator magazynu klucza szyfrowania
|
|
NetworkAccessPolicy
|
Zasady uzyskiwania dostępu do dysku za pośrednictwem sieci.
|
|
OperatingSystemTypes
|
Typ systemu operacyjnego.
|
|
PropertyUpdatesInProgress
|
Właściwości dysku, dla którego trwa oczekiwanie na aktualizację.
|
|
ProvisionedBandwidthCopyOption
|
Jeśli to pole jest ustawione na migawkę, a polecenie createOption to CopyStart, migawka zostanie skopiowana z szybciej.
|
|
PublicNetworkAccess
|
Zasady kontrolowania eksportu na dysku.
|
|
ShareInfoElement
|
|
|
SourceVault
|
Identyfikator magazynu to identyfikator zasobu usługi Azure Resource Manager w postaci /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
|
|
SupportedCapabilities
|
Lista obsługiwanych możliwości utrwalone w zasobie dysku na potrzeby użycia maszyny wirtualnej.
|
|
SupportedSecurityOption
|
Odnosi się do możliwości zabezpieczeń dysku obsługiwanego w celu utworzenia zaufanego uruchamiania lub poufnej maszyny wirtualnej
|
|
systemData
|
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
|
ApiError
Objekt
Błąd interfejsu API.
| Nazwisko |
Typ |
Opis |
|
code
|
string
|
Kod błędu.
|
|
details
|
ApiErrorBase[]
|
Szczegóły błędu interfejsu API
|
|
innererror
|
InnerError
|
Błąd wewnętrzny interfejsu API
|
|
message
|
string
|
Komunikat o błędzie.
|
|
target
|
string
|
Element docelowy określonego błędu.
|
ApiErrorBase
Objekt
Baza błędów interfejsu API.
| Nazwisko |
Typ |
Opis |
|
code
|
string
|
Kod błędu.
|
|
message
|
string
|
Komunikat o błędzie.
|
|
target
|
string
|
Element docelowy określonego błędu.
|
Architecture
Wyliczenie
Architektura procesora CPU obsługiwana przez dysk systemu operacyjnego.
AvailabilityPolicy
Objekt
W przypadku problemu z dostępnością lub łącznością z dyskiem danych określ zachowanie maszyny wirtualnej
AvailabilityPolicyDiskDelay
Wyliczenie
Określa sposób obsługi dysków z wolnymi wejściami / wyjściami.
| Wartość |
Opis |
|
None
|
Domyślnie jest to zachowanie bez określonych zasad av, czyli ponowne uruchomienie maszyny wirtualnej po wolnym we/wy dysku.
|
|
AutomaticReattach
|
W przypadku awarii operacji we/wy dysku lub powolnej odpowiedzi spróbuj odłączyć, a następnie ponownie podłączyć dysk.
|
CloudError
Objekt
Odpowiedź na błąd z usługi Obliczeniowej.
| Nazwisko |
Typ |
Opis |
|
error
|
ApiError
|
Błąd interfejsu API.
|
ConfidentialVMVersion
Wyliczenie
Wskazuje wersję Confidential VM dla danego zasobu.
| Wartość |
Opis |
|
V1
|
V1 oznacza, że zasób nie posiada powiązanych metadanych maszyny wirtualnej.
|
|
V2
|
V2 wskazuje, że zasób posiada powiązane metadane maszyny wirtualnej.
|
createdByType
Wyliczenie
Typ tożsamości, która utworzyła zasób.
| Wartość |
Opis |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
CreationData
Objekt
Dane używane podczas tworzenia dysku.
| Nazwisko |
Typ |
Opis |
|
createOption
|
DiskCreateOption
|
Wylicza to możliwe źródła tworzenia dysku.
|
|
elasticSanResourceId
|
string
|
Wymagane, jeśli polecenie createOption to CopyFromSanSnapshot. Jest to identyfikator arm źródłowej migawki elastycznego woluminu san.
|
|
galleryImageReference
|
ImageDiskReference
|
Wymagane w przypadku tworzenia na podstawie obrazu galerii. Identyfikator/sharedGalleryImageId/communityGalleryImageId obrazu ImageDiskReference będzie identyfikatorem ARM udostępnionej wersji obrazu galley, z której ma zostać utworzony dysk.
|
|
imageReference
|
ImageDiskReference
|
Informacje o źródle dysku dla obrazów pir lub użytkowników.
|
|
instantAccessDurationMinutes
|
integer
(int64)
minimum: 1
|
W przypadku migawek utworzonych na podstawie dysku SSD w warstwie Premium w wersji 2 lub Ultra ta właściwość określa czas w minutach, w którym migawka jest zachowywana w celu natychmiastowego dostępu w celu umożliwienia szybszego przywracania.
|
|
logicalSectorSize
|
integer
(int32)
|
Rozmiar sektora logicznego w bajtach dla dysków w warstwie Ultra. Obsługiwane wartości to 512 ad 4096. Wartość domyślna to 4096.
|
|
performancePlus
|
boolean
|
Ustaw tę flagę na wartość true, aby zwiększyć wydajność docelową wdrożonego dysku, zobacz tutaj w odpowiednim celu wydajności. Tę flagę można ustawić tylko w czasie tworzenia dysku i nie można jej wyłączyć po włączeniu.
|
|
provisionedBandwidthCopySpeed
|
ProvisionedBandwidthCopyOption
|
Jeśli to pole jest ustawione na migawkę, a polecenie createOption to CopyStart, migawka zostanie skopiowana z szybciej.
|
|
securityDataUri
|
string
|
Jeśli parametr createOption to ImportSecure, jest to identyfikator URI obiektu blob, który ma zostać zaimportowany do stanu gościa maszyny wirtualnej.
|
|
securityMetadataUri
|
string
(uri)
|
Jeśli createOption ma wartość ImportSecure, jest to identyfikator URI obiektu blob, który ma zostać zaimportowany do metadanych maszyny wirtualnej dla poufnej maszyny wirtualnej.
|
|
sourceResourceId
|
string
|
Jeśli parametr createOption to Copy, jest to identyfikator arm źródłowej migawki lub dysku.
|
|
sourceUniqueId
|
string
|
Jeśli to pole jest ustawione, jest to unikatowy identyfikator identyfikujący źródło tego zasobu.
|
|
sourceUri
|
string
|
Jeśli parametr createOption to Import, jest to identyfikator URI obiektu blob, który ma zostać zaimportowany na dysk zarządzany.
|
|
storageAccountId
|
string
|
Wymagane, jeśli polecenie createOption to Import. Identyfikator usługi Azure Resource Manager konta magazynu zawierającego obiekt blob do zaimportowania jako dysk.
|
|
uploadSizeBytes
|
integer
(int64)
|
Jeśli parametr createOption to Upload, jest to rozmiar zawartości przekazywania, w tym stopka dysku VHD. Ta wartość powinna należeć do 20972032 (20 bajtów MiB + 512 dla stopki dysku VHD) i 35183298347520 bajtów (32 TiB + 512 bajtów dla stopki dysku VHD).
|
DataAccessAuthMode
Wyliczenie
Dodatkowe wymagania dotyczące uwierzytelniania podczas eksportowania lub przekazywania do dysku lub migawki.
| Wartość |
Opis |
|
AzureActiveDirectory
|
Podczas eksportowania/przekazywania adresu URL system sprawdza, czy użytkownik ma tożsamość w Azure Active Directory i ma niezbędne uprawnienia do eksportowania/przekazywania danych. Zapoznaj się z aka.ms/DisksAzureADAuth.
|
|
None
|
Podczas uzyskiwania dostępu do adresu URL eksportowania/przekazywania nie będzie wykonywane żadne dodatkowe uwierzytelnianie.
|
Disk
Objekt
Zasób dysku.
| Nazwisko |
Typ |
Opis |
|
extendedLocation
|
ExtendedLocation
|
Lokalizacja rozszerzona, w której zostanie utworzony dysk. Nie można zmienić lokalizacji rozszerzonej.
|
|
id
|
string
|
W pełni określony identyfikator zasobu dla tego zasobu. Przykład - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
location
|
string
|
Lokalizacja geograficzna, w której znajduje się zasób
|
|
managedBy
|
string
|
Względny identyfikator URI zawierający identyfikator maszyny wirtualnej z dołączonym dyskiem.
|
|
managedByExtended
|
string[]
|
Lista względnych identyfikatorów URI zawierających identyfikatory maszyn wirtualnych, które mają dołączony dysk. wartość maxShares powinna być ustawiona na wartość większą niż jedną dla dysków, aby umożliwić ich dołączanie do wielu maszyn wirtualnych.
|
|
name
|
string
|
Nazwa zasobu
|
|
properties.LastOwnershipUpdateTime
|
string
(date-time)
|
Czas UTC ostatniej zmiany stanu własności dysku, tj. czas ostatniego dołączenia lub odłączenia dysku od maszyny wirtualnej lub czasu, w którym został dołączony dysk, został cofnięty lub uruchomiony.
|
|
properties.availabilityPolicy
|
AvailabilityPolicy
|
Określa, jak platforma traktuje awarie dysku
|
|
properties.burstingEnabled
|
boolean
|
Ustaw wartość true, aby włączyć zwiększenie wydajności poza aprowizowaną wartość docelową wydajności dysku. "Wyburzanie jest domyślnie wyłączone." Nie dotyczy dysków w warstwie Ultra.
|
|
properties.burstingEnabledTime
|
string
(date-time)
|
Ostatni czas ostatniego włączenia skalowania na dysku.
|
|
properties.completionPercent
|
number
(float)
|
Procent wykonania kopii w tle po utworzeniu zasobu za pomocą operacji CopyStart.
|
|
properties.creationData
|
CreationData
|
Informacje o źródle dysku. Nie można zmienić informacji creationData po utworzeniu dysku.
|
|
properties.dataAccessAuthMode
|
DataAccessAuthMode
|
Dodatkowe wymagania dotyczące uwierzytelniania podczas eksportowania lub przekazywania do dysku lub migawki.
|
|
properties.diskAccessId
|
string
|
Identyfikator usługi ARM zasobu DiskAccess do używania prywatnych punktów końcowych na dyskach.
|
|
properties.diskIOPSReadOnly
|
integer
(int64)
|
Całkowita liczba operacji we/wy na sekundę, która będzie dozwolona na wszystkich maszynach wirtualnych instalowania dysku udostępnionego jako ReadOnly. Jedna operacja może przesyłać od 4k do 256 tys. bajtów.
|
|
properties.diskIOPSReadWrite
|
integer
(int64)
|
Liczba operacji we/wy na sekundę dozwolonych dla tego dysku; można ustawić tylko dla dysków UltraSSD. Jedna operacja może przesyłać od 4k do 256 tys. bajtów.
|
|
properties.diskMBpsReadOnly
|
integer
(int64)
|
Łączna przepływność (MB/s), która będzie dozwolona na wszystkich maszynach wirtualnych instalowania dysku udostępnionego jako ReadOnly. Mb/s oznacza miliony bajtów na sekundę - MB w tym miejscu używa notacji ISO, mocy 10.
|
|
properties.diskMBpsReadWrite
|
integer
(int64)
|
Dozwolona przepustowość dla tego dysku; można ustawić tylko dla dysków UltraSSD. Mb/s oznacza miliony bajtów na sekundę - MB w tym miejscu używa notacji ISO, mocy 10.
|
|
properties.diskSizeBytes
|
integer
(int64)
|
Rozmiar dysku w bajtach. To pole jest tylko do odczytu.
|
|
properties.diskSizeGB
|
integer
(int32)
|
Jeśli parametr creationData.createOption jest pusty, to pole jest obowiązkowe i wskazuje rozmiar dysku do utworzenia. Jeśli to pole jest obecne w przypadku aktualizacji lub tworzenia z innymi opcjami, oznacza to zmianę rozmiaru. Zmiany rozmiaru są dozwolone tylko wtedy, gdy dysk nie jest dołączony do uruchomionej maszyny wirtualnej i może zwiększyć tylko rozmiar dysku.
|
|
properties.diskState
|
DiskState
|
Stan dysku.
|
|
properties.encryption
|
Encryption
|
Właściwość szyfrowania może służyć do szyfrowania danych magazynowanych przy użyciu kluczy zarządzanych przez klienta lub kluczy zarządzanych przez platformę.
|
|
properties.encryptionSettingsCollection
|
EncryptionSettingsCollection
|
Kolekcja ustawień szyfrowania używana dla usługi Azure Disk Encryption może zawierać wiele ustawień szyfrowania na dysk lub migawkę.
|
|
properties.hyperVGeneration
|
HyperVGeneration
|
Generacja hypervisora maszyny wirtualnej. Dotyczy tylko dysków systemu operacyjnego.
|
|
properties.maxShares
|
integer
(int32)
|
Maksymalna liczba maszyn wirtualnych, które mogą być dołączane do dysku w tym samym czasie. Wartość większa niż jedna wskazuje dysk, który można instalować na wielu maszynach wirtualnych jednocześnie.
|
|
properties.networkAccessPolicy
|
NetworkAccessPolicy
|
Zasady uzyskiwania dostępu do dysku za pośrednictwem sieci.
|
|
properties.optimizedForFrequentAttach
|
boolean
|
Ustawienie tej właściwości na wartość true zwiększa niezawodność i wydajność dysków danych, które są często (więcej niż 5 razy dziennie) przez odłączenie od jednej maszyny wirtualnej i dołączone do innej. Ta właściwość nie powinna być ustawiana dla dysków, które nie są odłączone i dołączone często, ponieważ powoduje, że dyski nie są zgodne z domeną błędów maszyny wirtualnej.
|
|
properties.osType
|
OperatingSystemTypes
|
Typ systemu operacyjnego.
|
|
properties.propertyUpdatesInProgress
|
PropertyUpdatesInProgress
|
Właściwości dysku, dla którego trwa oczekiwanie na aktualizację.
|
|
properties.provisioningState
|
string
|
Stan aprowizacji dysku.
|
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
Zasady kontrolowania eksportu na dysku.
|
|
properties.purchasePlan
|
DiskPurchasePlan
|
Informacje o planie zakupu obrazu, z którego utworzono dysk systemu operacyjnego. Np. — {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}
|
|
properties.securityProfile
|
DiskSecurityProfile
|
Zawiera informacje dotyczące zabezpieczeń zasobu.
|
|
properties.shareInfo
|
ShareInfoElement[]
|
Szczegóły listy wszystkich maszyn wirtualnych z dołączonym dyskiem. wartość maxShares powinna być ustawiona na wartość większą niż jedną dla dysków, aby umożliwić ich dołączanie do wielu maszyn wirtualnych.
|
|
properties.supportedCapabilities
|
SupportedCapabilities
|
Lista obsługiwanych możliwości obrazu, z którego utworzono dysk systemu operacyjnego.
|
|
properties.supportsHibernation
|
boolean
|
Wskazuje system operacyjny na dysku obsługuje hibernacji.
|
|
properties.tier
|
string
|
Warstwa wydajności dysku (np. P4, S10), jak opisano tutaj: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Nie dotyczy dysków w warstwie Ultra.
|
|
properties.timeCreated
|
string
(date-time)
|
Czas utworzenia dysku.
|
|
properties.uniqueId
|
string
|
Unikatowy identyfikator GUID identyfikujący zasób.
|
|
sku
|
DiskSku
|
Nazwa jednostki SKU dysków. Można Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS lub PremiumV2_LRS.
|
|
systemData
|
systemData
|
Metadane usługi Azure Resource Manager zawierające informacje „createdBy” i „modifiedBy”.
|
|
tags
|
object
|
Tagi zasobów.
|
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
|
zones
|
string[]
|
Lista Strefa logiczna dla dysku.
|
DiskCreateOption
Wyliczenie
Wylicza to możliwe źródła tworzenia dysku.
| Wartość |
Opis |
|
Empty
|
Utwórz pusty dysk danych o rozmiarze określonym przez diskSizeGB.
|
|
Attach
|
Dysk zostanie dołączony do maszyny wirtualnej.
|
|
FromImage
|
Utwórz nowy dysk na podstawie obrazu platformy określonego przez dany obrazReference lub galleryImageReference.
|
|
Import
|
Utwórz dysk, importując z obiektu blob określonego przez identyfikator sourceUri na koncie magazynu określonym przez wartość storageAccountId.
|
|
Copy
|
Utwórz nowy dysk lub migawkę, kopiując go z dysku lub migawki określonej przez daną wartość sourceResourceId.
|
|
Restore
|
Utwórz nowy dysk, kopiując z punktu odzyskiwania kopii zapasowej.
|
|
Upload
|
Utwórz nowy dysk, uzyskując token zapisu i używając go do bezpośredniego przekazania zawartości dysku.
|
|
CopyStart
|
Utwórz nowy dysk przy użyciu procesu kopiowania głębokiego, w którym tworzenie zasobu jest uznawane za ukończone dopiero po skopiowaniu wszystkich danych ze źródła.
|
|
ImportSecure
|
Podobnie jak opcja Importuj tworzenie. Utwórz nowy zaufany dysk obsługiwany przez maszynę wirtualną lub poufną maszynę wirtualną, importując dodatkowe obiekty blob dla stanu gościa maszyny wirtualnej określonego przez securityDataUri i metadanych maszyny wirtualnej określonych przez securityMetadataUri na koncie magazynu określonym przez storageAccountId. Metadane maszyny wirtualnej są opcjonalne i wymagane tylko w przypadku niektórych konfiguracji poufnych maszyn wirtualnych i nie są wymagane w przypadku zaufanej maszyny wirtualnej uruchamiania.
|
|
UploadPreparedSecure
|
Podobnie jak opcja Przekaż tworzenie. Utwórz nowy zaufany dysk obsługiwany przez maszynę wirtualną lub poufną maszynę wirtualną i przekaż ją przy użyciu tokenu zapisu na dysku, stanie gościa maszyny wirtualnej i metadanych maszyny wirtualnej. Metadane maszyny wirtualnej są opcjonalne i wymagane tylko w przypadku niektórych konfiguracji poufnych maszyn wirtualnych i nie są wymagane w przypadku zaufanej maszyny wirtualnej uruchamiania.
|
|
CopyFromSanSnapshot
|
Tworzenie nowego dysku przez wyeksportowanie z migawki elastycznego woluminu san
|
DiskPurchasePlan
Objekt
Służy do ustanawiania kontekstu zakupu dowolnego artefaktu innej firmy za pośrednictwem platformy MarketPlace.
| Nazwisko |
Typ |
Opis |
|
name
|
string
|
Identyfikator planu.
|
|
product
|
string
|
Określa produkt obrazu z witryny Marketplace. Jest to ta sama wartość co offer w elemencie imageReference.
|
|
promotionCode
|
string
|
Kod promocji oferty.
|
|
publisher
|
string
|
Identyfikator wydawcy.
|
DiskSecurityProfile
Objekt
Zawiera informacje dotyczące zabezpieczeń zasobu.
| Nazwisko |
Typ |
Opis |
|
confidentialVMVersion
|
ConfidentialVMVersion
|
Wskazuje wersję Confidential VM dla danego zasobu.
|
|
secureVMDiskEncryptionSetId
|
string
|
ResourceId zestawu szyfrowania dysku skojarzonego z dyskiem obsługiwanym przez poufne maszyny wirtualne zaszyfrowane przy użyciu klucza zarządzanego przez klienta
|
|
securityType
|
DiskSecurityTypes
|
Określa typ zabezpieczeń maszyny wirtualnej. Dotyczy tylko dysków systemu operacyjnego.
|
DiskSecurityTypes
Wyliczenie
Określa typ zabezpieczeń maszyny wirtualnej. Dotyczy tylko dysków systemu operacyjnego.
| Wartość |
Opis |
|
TrustedLaunch
|
Zaufane uruchamianie zapewnia funkcje zabezpieczeń, takie jak bezpieczny rozruch i wirtualny moduł Trusted Platform Module (vTPM)
|
|
ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey
|
Wskazuje poufny dysk maszyny wirtualnej z zaszyfrowanym tylko stanem gościa maszyny wirtualnej
|
|
ConfidentialVM_DiskEncryptedWithPlatformKey
|
Wskazuje poufny dysk maszyny wirtualnej z zarówno dyskiem systemu operacyjnego, jak i stanem gościa maszyny wirtualnej zaszyfrowanym przy użyciu klucza zarządzanego platformy
|
|
ConfidentialVM_DiskEncryptedWithCustomerKey
|
Wskazuje poufny dysk maszyny wirtualnej z zarówno dyskiem systemu operacyjnego, jak i stanem gościa maszyny wirtualnej zaszyfrowanym przy użyciu klucza zarządzanego przez klienta
|
|
ConfidentialVM_NonPersistedTPM
|
Wskazuje poufny dysk maszyny wirtualnej z efemerycznym maszyną wirtualną vTPM. Stan vTPM nie jest utrwalany w przypadku ponownych uruchomień maszyny wirtualnej.
|
DiskSku
Objekt
Nazwa jednostki SKU dysków. Można Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS lub PremiumV2_LRS.
DiskState
Wyliczenie
Spowoduje to wyliczenie możliwego stanu dysku.
| Wartość |
Opis |
|
Unattached
|
Dysk nie jest używany i można go dołączyć do maszyny wirtualnej.
|
|
Attached
|
Dysk jest obecnie dołączony do uruchomionej maszyny wirtualnej.
|
|
Reserved
|
Dysk jest dołączony do zatrzymanej cofniętych przydziałów maszyny wirtualnej.
|
|
Frozen
|
Dysk jest dołączony do maszyny wirtualnej, która jest w stanie hibernacji.
|
|
ActiveSAS
|
Dysk ma obecnie skojarzony identyfikator URI aktywnej sygnatury dostępu współdzielonego.
|
|
ActiveSASFrozen
|
Dysk jest dołączony do maszyny wirtualnej w stanie hibernacji i ma skojarzony z nim aktywny identyfikator URI sygnatury dostępu współdzielonego.
|
|
ReadyToUpload
|
Dysk jest gotowy do utworzenia przez przekazanie, żądając tokenu zapisu.
|
|
ActiveUpload
|
Dysk jest tworzony na potrzeby przekazywania, a token zapisu został wystawiony na potrzeby przekazywania do niego.
|
DiskStorageAccountTypes
Wyliczenie
Nazwa SKU.
| Wartość |
Opis |
|
Standard_LRS
|
Lokalnie redundantne magazynowanie HDD w warstwie Standardowej. Najlepsze w przypadku kopii zapasowych, niekrytycznych i rzadko używanych.
|
|
Premium_LRS
|
Lokalnie nadmiarowy magazyn SSD w warstwie Premium. Najlepsze dla zadań produkcyjnych i wrażliwych na wydajność.
|
|
StandardSSD_LRS
|
Lokalnie nadmiarowa pamięć masowa SSD Standard. Najlepsze dla serwerów internetowych, lekko używane aplikacje dla przedsiębiorstw i tworzenie/testowanie.
|
|
UltraSSD_LRS
|
Magazyn lokalnie nadmiarowy SSD w warstwie Ultra. Najlepsze w przypadku obciążeń intensywnie korzystających z operacji we/wy, takich jak SAP HANA, bazy danych najwyższego poziomu (na przykład SQL, Oracle) i inne obciążenia z dużą liczbą transakcji.
|
|
Premium_ZRS
|
Magazyn strefowo nadmiarowy SSD w warstwie Premium. Najlepiej w przypadku obciążeń produkcyjnych, które wymagają odporności magazynu na awarie stref.
|
|
StandardSSD_ZRS
|
Magazyn strefowo nadmiarowy SSD w warstwie Standardowa. Najlepsze dla serwerów internetowych, lekko używane aplikacje dla przedsiębiorstw i tworzenie/testowanie, które wymagają odporności magazynu na awarie strefy.
|
|
PremiumV2_LRS
|
Magazyn lokalnie nadmiarowy SSD w warstwie Premium w wersji 2. Najlepsze w przypadku obciążeń produkcyjnych i wrażliwych na wydajność, które stale wymagają małych opóźnień i dużej liczby operacji we/wy na sekundę i przepływności.
|
Encryption
Objekt
Szyfrowanie ustawień magazynowanych dla dysku lub migawki
| Nazwisko |
Typ |
Opis |
|
diskEncryptionSetId
|
string
|
ResourceId zestawu szyfrowania dysku, który ma być używany do włączania szyfrowania magazynowanych.
|
|
type
|
EncryptionType
|
Typ klucza używanego do szyfrowania danych dysku.
|
EncryptionSettingsCollection
Objekt
Ustawienia szyfrowania dysku lub migawki
| Nazwisko |
Typ |
Opis |
|
enabled
|
boolean
|
Ustaw tę flagę na true i podaj wartość DiskEncryptionKey i opcjonalnie KeyEncryptionKey, aby włączyć szyfrowanie. Ustaw tę flagę na wartość false i usuń wartość DiskEncryptionKey i KeyEncryptionKey, aby wyłączyć szyfrowanie. Jeśli wartość EncryptionSettings ma wartość null w obiekcie żądania, istniejące ustawienia pozostaną niezmienione.
|
|
encryptionSettings
|
EncryptionSettingsElement[]
|
Kolekcja ustawień szyfrowania, po jednym dla każdego woluminu dysku.
|
|
encryptionSettingsVersion
|
string
|
Opisuje typ szyfrowania używany dla dysków. Po ustawieniu tego pola nie można go zastąpić. Wartość "1.0" odpowiada usłudze Azure Disk Encryption z aplikacją usługi AAD."1.1" odpowiada usłudze Azure Disk Encryption.
|
EncryptionSettingsElement
Objekt
Ustawienia szyfrowania dla jednego woluminu dysku.
| Nazwisko |
Typ |
Opis |
|
diskEncryptionKey
|
KeyVaultAndSecretReference
|
Adres URL wpisu tajnego usługi Key Vault i identyfikator magazynu klucza szyfrowania dysku
|
|
keyEncryptionKey
|
KeyVaultAndKeyReference
|
Adres URL klucza usługi Key Vault i identyfikator magazynu klucza szyfrowania klucza. Klucz KeyEncryptionKey jest opcjonalny i jeśli jest używany do odpakowania klucza szyfrowania dysku.
|
EncryptionType
Wyliczenie
Typ klucza używanego do szyfrowania danych dysku.
| Wartość |
Opis |
|
EncryptionAtRestWithPlatformKey
|
Dysk jest szyfrowany w spoczynku przy użyciu klucza zarządzanego platformy. Jest to domyślny typ szyfrowania. To nie jest prawidłowy typ szyfrowania dla zestawów szyfrowania dysków.
|
|
EncryptionAtRestWithCustomerKey
|
Dysk jest szyfrowany w spoczynku przy użyciu klucza zarządzanego przez klienta, który można zmienić i odwołać przez klienta.
|
|
EncryptionAtRestWithPlatformAndCustomerKeys
|
Dysk jest szyfrowany w spoczynku z 2 warstwami szyfrowania. Jednym z kluczy jest zarządzany przez klienta, a drugi to Platforma zarządzana.
|
ExtendedLocation
Objekt
Typ złożony lokalizacji rozszerzonej.
| Nazwisko |
Typ |
Opis |
|
name
|
string
|
Nazwa lokalizacji rozszerzonej.
|
|
type
|
ExtendedLocationTypes
|
Typ lokalizacji rozszerzonej.
|
ExtendedLocationTypes
Wyliczenie
Typ lokalizacji rozszerzonej.
HyperVGeneration
Wyliczenie
Generacja hypervisora maszyny wirtualnej. Dotyczy tylko dysków systemu operacyjnego.
ImageDiskReference
Objekt
Obraz źródłowy używany do tworzenia dysku.
| Nazwisko |
Typ |
Opis |
|
communityGalleryImageId
|
string
|
Względny identyfikator URI zawierający dokumentację obrazu galerii obliczeniowej platformy Azure społeczności.
|
|
id
|
string
|
Względny identyfikator URI zawierający odwołanie do obrazu usługi Azure Compute Gallery, repozytorium obrazów platformy, obrazu użytkownika lub galerii obliczeniowej platformy.
|
|
lun
|
integer
(int32)
|
Jeśli dysk jest tworzony na podstawie dysku danych obrazu, jest to indeks wskazujący, które dyski danych na obrazie mają być używane. W przypadku dysków systemu operacyjnego to pole ma wartość null.
|
|
sharedGalleryImageId
|
string
|
Względny identyfikator URI zawierający bezpośredni udostępniony obraz usługi Azure Compute Gallery.
|
InnerError
Objekt
Szczegóły błędu wewnętrznego.
| Nazwisko |
Typ |
Opis |
|
errordetail
|
string
|
Wewnętrzny komunikat o błędzie lub zrzut wyjątku.
|
|
exceptiontype
|
string
|
Typ wyjątku.
|
KeyVaultAndKeyReference
Objekt
Adres URL klucza usługi Key Vault i identyfikator magazynu keK jest opcjonalny, a jeśli jest on używany do odpakowywania klucza szyfrowania
| Nazwisko |
Typ |
Opis |
|
keyUrl
|
string
|
Adres URL wskazujący klucz lub wpis tajny w usłudze KeyVault
|
|
sourceVault
|
SourceVault
|
Identyfikator zasobu usługi KeyVault zawierającej klucz lub wpis tajny
|
KeyVaultAndSecretReference
Objekt
Adres URL wpisu tajnego usługi Key Vault i identyfikator magazynu klucza szyfrowania
| Nazwisko |
Typ |
Opis |
|
secretUrl
|
string
|
Adres URL wskazujący klucz lub wpis tajny w usłudze KeyVault
|
|
sourceVault
|
SourceVault
|
Identyfikator zasobu usługi KeyVault zawierającej klucz lub wpis tajny
|
NetworkAccessPolicy
Wyliczenie
Zasady uzyskiwania dostępu do dysku za pośrednictwem sieci.
| Wartość |
Opis |
|
AllowAll
|
Dysk można wyeksportować lub przekazać do dowolnej sieci.
|
|
AllowPrivate
|
Dysk można wyeksportować lub przekazać do usługi przy użyciu prywatnych punktów końcowych zasobu DiskAccess.
|
|
DenyAll
|
Nie można wyeksportować dysku.
|
OperatingSystemTypes
Wyliczenie
Typ systemu operacyjnego.
| Wartość |
Opis |
|
Windows
|
|
|
Linux
|
|
PropertyUpdatesInProgress
Objekt
Właściwości dysku, dla którego trwa oczekiwanie na aktualizację.
| Nazwisko |
Typ |
Opis |
|
targetTier
|
string
|
Docelowa warstwa wydajności dysku, jeśli operacja zmiany warstwy jest w toku.
|
ProvisionedBandwidthCopyOption
Wyliczenie
Jeśli to pole jest ustawione na migawkę, a polecenie createOption to CopyStart, migawka zostanie skopiowana z szybciej.
| Wartość |
Opis |
|
None
|
|
|
Enhanced
|
|
PublicNetworkAccess
Wyliczenie
Zasady kontrolowania eksportu na dysku.
| Wartość |
Opis |
|
Enabled
|
Możesz wygenerować identyfikator URI sygnatury dostępu współdzielonego, aby uzyskać dostęp do podstawowych danych dysku publicznie w Internecie, gdy ustawienie NetworkAccessPolicy ma wartość AllowAll. Dostęp do danych można uzyskać za pośrednictwem identyfikatora URI sygnatury dostępu współdzielonego tylko z zaufanej sieci wirtualnej platformy Azure, gdy parametr NetworkAccessPolicy ma ustawioną wartość AllowPrivate.
|
|
Disabled
|
Nie można uzyskać dostępu do danych bazowych dysku publicznie w Internecie, nawet jeśli wartość NetworkAccessPolicy jest ustawiona na Wartość AllowAll. Dostęp do danych można uzyskać za pośrednictwem identyfikatora URI sygnatury dostępu współdzielonego tylko z zaufanej sieci wirtualnej platformy Azure, gdy parametr NetworkAccessPolicy ma ustawioną wartość AllowPrivate.
|
ShareInfoElement
Objekt
| Nazwisko |
Typ |
Opis |
|
vmUri
|
string
|
Względny identyfikator URI zawierający identyfikator maszyny wirtualnej z dołączonym dyskiem.
|
SourceVault
Objekt
Identyfikator magazynu to identyfikator zasobu usługi Azure Resource Manager w postaci /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
| Nazwisko |
Typ |
Opis |
|
id
|
string
|
Identyfikator zasobu
|
SupportedCapabilities
Objekt
Lista obsługiwanych możliwości utrwalone w zasobie dysku na potrzeby użycia maszyny wirtualnej.
| Nazwisko |
Typ |
Opis |
|
acceleratedNetwork
|
boolean
|
Prawda, jeśli obraz, z którego jest tworzony dysk systemu operacyjnego, obsługuje przyspieszoną sieć.
|
|
architecture
|
Architecture
|
Architektura procesora CPU obsługiwana przez dysk systemu operacyjnego.
|
|
diskControllerTypes
|
string
|
Kontrolery dysków obsługiwane przez dysk systemu operacyjnego. W przypadku ustawienia może to być SCSI lub SCSI, NVME lub NVME, SCSI.
|
|
supportedSecurityOption
|
SupportedSecurityOption
|
Odnosi się do możliwości zabezpieczeń dysku obsługiwanego w celu utworzenia zaufanego uruchamiania lub poufnej maszyny wirtualnej
|
SupportedSecurityOption
Wyliczenie
Odnosi się do możliwości zabezpieczeń dysku obsługiwanego w celu utworzenia zaufanego uruchamiania lub poufnej maszyny wirtualnej
| Wartość |
Opis |
|
TrustedLaunchSupported
|
Dysk obsługuje tworzenie zaufanych maszyn wirtualnych uruchamiania.
|
|
TrustedLaunchAndConfidentialVMSupported
|
Dysk obsługuje tworzenie zarówno zaufanych maszyn wirtualnych, jak i poufnych maszyn wirtualnych.
|
systemData
Objekt
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
| Nazwisko |
Typ |
Opis |
|
createdAt
|
string
(date-time)
|
Sygnatura czasowa tworzenia zasobu (UTC).
|
|
createdBy
|
string
|
Tożsamość, która utworzyła zasób.
|
|
createdByType
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
|
lastModifiedAt
|
string
(date-time)
|
Znacznik czasu ostatniej modyfikacji zasobu (UTC)
|
|
lastModifiedBy
|
string
|
Tożsamość, która ostatnio zmodyfikowała zasób.
|
|
lastModifiedByType
|
createdByType
|
Typ tożsamości, która ostatnio zmodyfikowała zasób.
|