Aggiorna (patch) un disco.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}?api-version=2024-03-02
Parametri dell'URI
Nome |
In |
Necessario |
Tipo |
Descrizione |
diskName
|
path |
True
|
string
|
Nome del disco gestito che viene creato. Il nome non può essere modificato dopo la creazione del disco. I caratteri supportati per il nome sono a-z, A-Z, 0-9, _ e -. La lunghezza massima del nome è di 80 caratteri.
|
resourceGroupName
|
path |
True
|
string
|
Nome del gruppo di risorse.
|
subscriptionId
|
path |
True
|
string
|
Credenziali di sottoscrizione che identificano in modo univoco la sottoscrizione di Microsoft Azure. L'ID sottoscrizione fa parte dell'URI per ogni chiamata al servizio.
|
api-version
|
query |
True
|
string
|
Versione dell'API client.
|
Corpo della richiesta
Nome |
Tipo |
Descrizione |
properties.burstingEnabled
|
boolean
|
Impostare su true per abilitare il bursting oltre la destinazione delle prestazioni con provisioning del disco. Il bursting è disabilitato per impostazione predefinita. Non si applica ai dischi Ultra.
|
properties.dataAccessAuthMode
|
DataAccessAuthMode
|
Requisiti di autenticazione aggiuntivi per l'esportazione o il caricamento in un disco o uno snapshot.
|
properties.diskAccessId
|
string
|
ID ARM della risorsa DiskAccess per l'uso di endpoint privati su dischi.
|
properties.diskIOPSReadOnly
|
integer
|
Numero totale di operazioni di I/O al secondo consentite in tutte le macchine virtuali che montano il disco condiviso come ReadOnly. Un'operazione può trasferire tra 4k e 256.000 byte.
|
properties.diskIOPSReadWrite
|
integer
|
Numero di operazioni di I/O al secondo consentite per questo disco; solo impostabile per i dischi UltraSSD. Un'operazione può trasferire tra 4k e 256.000 byte.
|
properties.diskMBpsReadOnly
|
integer
|
Velocità effettiva totale (MBps) che sarà consentita in tutte le macchine virtuali che montano il disco condiviso come ReadOnly. MBps significa milioni di byte al secondo - MB qui usa la notazione ISO, di poteri di 10.
|
properties.diskMBpsReadWrite
|
integer
|
Larghezza di banda consentita per questo disco; solo impostabile per i dischi UltraSSD. MBps significa milioni di byte al secondo - MB qui usa la notazione ISO, di poteri di 10.
|
properties.diskSizeGB
|
integer
|
Se creationData.createOption è Vuoto, questo campo è obbligatorio e indica le dimensioni del disco da creare. Se questo campo è presente per gli aggiornamenti o la creazione con altre opzioni, indica un ridimensionamento. I ridimensionamenti sono consentiti solo se il disco non è collegato a una macchina virtuale in esecuzione e può aumentare solo le dimensioni del disco.
|
properties.encryption
|
Encryption
|
La proprietà di crittografia può essere usata per crittografare i dati inattivi con chiavi gestite dal cliente o chiavi gestite dalla piattaforma.
|
properties.encryptionSettingsCollection
|
EncryptionSettingsCollection
|
La raccolta di impostazioni di crittografia usata è Crittografia dischi di Azure, può contenere più impostazioni di crittografia per disco o snapshot.
|
properties.maxShares
|
integer
|
Numero massimo di macchine virtuali che possono essere collegate al disco contemporaneamente. Il valore maggiore di uno indica un disco che può essere montato in più macchine virtuali contemporaneamente.
|
properties.networkAccessPolicy
|
NetworkAccessPolicy
|
Criteri per l'accesso al disco tramite rete.
|
properties.optimizedForFrequentAttach
|
boolean
|
L'impostazione di questa proprietà su true migliora l'affidabilità e le prestazioni dei dischi dati che sono spesso (più di 5 volte al giorno) scollegati da una macchina virtuale e collegati a un altro. Questa proprietà non deve essere impostata per i dischi non scollegati e collegati frequentemente perché i dischi non sono allineati al dominio di errore della macchina virtuale.
|
properties.osType
|
OperatingSystemTypes
|
tipo di sistema operativo.
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
Criteri per controllare l'esportazione sul disco.
|
properties.purchasePlan
|
PurchasePlan
|
Informazioni sul piano di acquisto da aggiungere sul disco del sistema operativo
|
properties.supportedCapabilities
|
SupportedCapabilities
|
Elenco delle funzionalità supportate da aggiungere sul disco del sistema operativo.
|
properties.supportsHibernation
|
boolean
|
Indica che il sistema operativo in un disco supporta l'ibernazione.
|
properties.tier
|
string
|
Livello di prestazioni del disco ,ad esempio P4, S10, come descritto di seguito: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Non si applica ai dischi Ultra.
|
sku
|
DiskSku
|
Nome sku dei dischi. Può essere Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS o PremiumV2_LRS.
|
tags
|
object
|
Tag delle risorse
|
Risposte
Nome |
Tipo |
Descrizione |
200 OK
|
Disk
|
OK
|
202 Accepted
|
Disk
|
Accettato
|
Sicurezza
azure_auth
Flusso OAuth2 di Azure Active Directory
Tipo:
oauth2
Flow:
implicit
URL di autorizzazione:
https://login.microsoftonline.com/common/oauth2/authorize
Ambiti
Nome |
Descrizione |
user_impersonation
|
rappresentare l'account utente
|
Esempio
Create or update a bursting enabled managed disk.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"diskSizeGB": 1024,
"burstingEnabled": true
}
}
import com.azure.resourcemanager.compute.models.DiskUpdate;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_CreateOrUpdate_BurstingEnabled.json
*/
/**
* Sample code: Create or update a bursting enabled managed disk.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateABurstingEnabledManagedDisk(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks().update("myResourceGroup", "myDisk",
new DiskUpdate().withDiskSizeGB(1024).withBurstingEnabled(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 typing import Any, IO, Union
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_bursting_enabled.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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"properties": {"burstingEnabled": True, "diskSizeGB": 1024}},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json
func ExampleDisksClient_BeginUpdate_createOrUpdateABurstingEnabledManagedDisk() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
BurstingEnabled: to.Ptr(true),
DiskSizeGB: to.Ptr[int32](1024),
},
}, 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// BurstingEnabled: to.Ptr(true),
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](1024),
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json
*/
async function createOrUpdateABurstingEnabledManagedDisk() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = { burstingEnabled: true, diskSizeGB: 1024 };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
DiskSizeGB = 1024,
BurstingEnabled = true,
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-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,
"burstingEnabled": true,
"provisioningState": "Succeeded"
},
"location": "West US",
"name": "myDisk"
}
Update a managed disk to add accelerated networking.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"supportedCapabilities": {
"acceleratedNetwork": false
}
}
}
import com.azure.resourcemanager.compute.models.DiskUpdate;
import com.azure.resourcemanager.compute.models.SupportedCapabilities;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_Update_AddAcceleratedNetworking.json
*/
/**
* Sample code: Update a managed disk to add accelerated networking.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
updateAManagedDiskToAddAcceleratedNetworking(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks().update("myResourceGroup", "myDisk",
new DiskUpdate().withSupportedCapabilities(new SupportedCapabilities().withAcceleratedNetwork(false)),
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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_update_add_accelerated_networking.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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"properties": {"supportedCapabilities": {"acceleratedNetwork": False}}},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.json
func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddAcceleratedNetworking() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
SupportedCapabilities: &armcompute.SupportedCapabilities{
AcceleratedNetwork: to.Ptr(false),
},
},
}, 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// ImageReference: &armcompute.ImageDiskReference{
// ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"),
// },
// },
// DiskSizeGB: to.Ptr[int32](127),
// HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// ProvisioningState: to.Ptr("Succeeded"),
// SupportedCapabilities: &armcompute.SupportedCapabilities{
// AcceleratedNetwork: to.Ptr(false),
// },
// },
// SKU: &armcompute.DiskSKU{
// Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
// Tier: to.Ptr("Standard"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.json
*/
async function updateAManagedDiskToAddAcceleratedNetworking() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = {
supportedCapabilities: { acceleratedNetwork: false },
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
SupportedCapabilities = new SupportedCapabilities
{
AcceleratedNetwork = false,
},
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"acceleratedNetwork": false
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"
}
},
"diskSizeGB": 127,
"provisioningState": "Updating"
}
}
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"acceleratedNetwork": false
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"
}
},
"diskSizeGB": 127,
"provisioningState": "Succeeded"
}
}
Update a managed disk to add architecture.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"supportedCapabilities": {
"architecture": "Arm64"
}
}
}
import com.azure.resourcemanager.compute.models.Architecture;
import com.azure.resourcemanager.compute.models.DiskUpdate;
import com.azure.resourcemanager.compute.models.SupportedCapabilities;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_Update_ToAddArchitecture.json
*/
/**
* Sample code: Update a managed disk to add architecture.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void updateAManagedDiskToAddArchitecture(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks()
.update("myResourceGroup", "myDisk",
new DiskUpdate()
.withSupportedCapabilities(new SupportedCapabilities().withArchitecture(Architecture.ARM64)),
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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_update_to_add_architecture.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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"properties": {"supportedCapabilities": {"architecture": "Arm64"}}},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_ToAddArchitecture.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_ToAddArchitecture.json
func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddArchitecture() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
SupportedCapabilities: &armcompute.SupportedCapabilities{
Architecture: to.Ptr(armcompute.ArchitectureArm64),
},
},
}, 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// ImageReference: &armcompute.ImageDiskReference{
// ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"),
// },
// },
// DiskSizeGB: to.Ptr[int32](127),
// HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// ProvisioningState: to.Ptr("Succeeded"),
// SupportedCapabilities: &armcompute.SupportedCapabilities{
// Architecture: to.Ptr(armcompute.ArchitectureArm64),
// },
// },
// SKU: &armcompute.DiskSKU{
// Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
// Tier: to.Ptr("Standard"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_ToAddArchitecture.json
*/
async function updateAManagedDiskToAddArchitecture() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = { supportedCapabilities: { architecture: "Arm64" } };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_ToAddArchitecture.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
SupportedCapabilities = new SupportedCapabilities
{
Architecture = ArchitectureType.Arm64,
},
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"architecture": "Arm64"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"
}
},
"diskSizeGB": 127,
"provisioningState": "Updating"
}
}
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"architecture": "Arm64"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"
}
},
"diskSizeGB": 127,
"provisioningState": "Succeeded"
}
}
Update a managed disk to add purchase plan.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"purchasePlan": {
"name": "myPurchasePlanName",
"publisher": "myPurchasePlanPublisher",
"product": "myPurchasePlanProduct",
"promotionCode": "myPurchasePlanPromotionCode"
}
}
}
import com.azure.resourcemanager.compute.models.DiskUpdate;
import com.azure.resourcemanager.compute.models.PurchasePlanAutoGenerated;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_Update_AddPurchasePlan.json
*/
/**
* Sample code: Update a managed disk to add purchase plan.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void updateAManagedDiskToAddPurchasePlan(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks()
.update("myResourceGroup", "myDisk",
new DiskUpdate().withPurchasePlan(new PurchasePlanAutoGenerated().withName("myPurchasePlanName")
.withPublisher("myPurchasePlanPublisher").withProduct("myPurchasePlanProduct")
.withPromotionCode("fakeTokenPlaceholder")),
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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_update_add_purchase_plan.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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={
"properties": {
"purchasePlan": {
"name": "myPurchasePlanName",
"product": "myPurchasePlanProduct",
"promotionCode": "myPurchasePlanPromotionCode",
"publisher": "myPurchasePlanPublisher",
}
}
},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddPurchasePlan.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddPurchasePlan.json
func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddPurchasePlan() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
PurchasePlan: &armcompute.DiskPurchasePlan{
Name: to.Ptr("myPurchasePlanName"),
Product: to.Ptr("myPurchasePlanProduct"),
PromotionCode: to.Ptr("myPurchasePlanPromotionCode"),
Publisher: to.Ptr("myPurchasePlanPublisher"),
},
},
}, 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// ImageReference: &armcompute.ImageDiskReference{
// ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"),
// },
// },
// DiskSizeGB: to.Ptr[int32](127),
// HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// ProvisioningState: to.Ptr("Succeeded"),
// PurchasePlan: &armcompute.DiskPurchasePlan{
// Name: to.Ptr("myPurchasePlanName"),
// Product: to.Ptr("myPurchasePlanProduct"),
// PromotionCode: to.Ptr("myPurchasePlanPromotionCode"),
// Publisher: to.Ptr("myPurchasePlanPublisher"),
// },
// },
// SKU: &armcompute.DiskSKU{
// Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
// Tier: to.Ptr("Standard"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddPurchasePlan.json
*/
async function updateAManagedDiskToAddPurchasePlan() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = {
purchasePlan: {
name: "myPurchasePlanName",
product: "myPurchasePlanProduct",
promotionCode: "myPurchasePlanPromotionCode",
publisher: "myPurchasePlanPublisher",
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddPurchasePlan.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
PurchasePlan = new DiskPurchasePlan("myPurchasePlanName", "myPurchasePlanPublisher", "myPurchasePlanProduct")
{
PromotionCode = "myPurchasePlanPromotionCode",
},
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"purchasePlan": {
"name": "myPurchasePlanName",
"publisher": "myPurchasePlanPublisher",
"product": "myPurchasePlanProduct",
"promotionCode": "myPurchasePlanPromotionCode"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"
}
},
"diskSizeGB": 127,
"provisioningState": "Updating"
}
}
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"purchasePlan": {
"name": "myPurchasePlanName",
"publisher": "myPurchasePlanPublisher",
"product": "myPurchasePlanProduct",
"promotionCode": "myPurchasePlanPromotionCode"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/test_test_pmc2pc1/ArtifactTypes/VMImage/Offers/marketplace_vm_test/Skus/test_sku/Versions/1.0.0"
}
},
"diskSizeGB": 127,
"provisioningState": "Succeeded"
}
}
Update a managed disk to add supportsHibernation.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"supportsHibernation": true
}
}
import com.azure.resourcemanager.compute.models.DiskUpdate;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_Update_AddSupportsHibernation.json
*/
/**
* Sample code: Update a managed disk to add supportsHibernation.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
updateAManagedDiskToAddSupportsHibernation(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks().update("myResourceGroup", "myDisk",
new DiskUpdate().withSupportsHibernation(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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_update_add_supports_hibernation.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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"properties": {"supportsHibernation": True}},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.json
func ExampleDisksClient_BeginUpdate_updateAManagedDiskToAddSupportsHibernation() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
SupportsHibernation: 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionImport),
// SourceURI: to.Ptr("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"),
// },
// DiskSizeGB: to.Ptr[int32](127),
// HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// ProvisioningState: to.Ptr("Succeeded"),
// SupportsHibernation: to.Ptr(true),
// },
// SKU: &armcompute.DiskSKU{
// Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
// Tier: to.Ptr("Standard"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.json
*/
async function updateAManagedDiskToAddSupportsHibernation() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = { supportsHibernation: true };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
SupportsHibernation = true,
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportsHibernation": true,
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
},
"diskSizeGB": 127,
"provisioningState": "Updating"
}
}
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportsHibernation": true,
"creationData": {
"createOption": "Import",
"sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd"
},
"diskSizeGB": 127,
"provisioningState": "Succeeded"
}
}
Update a managed disk to change tier.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"tier": "P30"
}
}
import com.azure.resourcemanager.compute.models.DiskUpdate;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_Update_ChangeTier.json
*/
/**
* Sample code: Update a managed disk to change tier.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void updateAManagedDiskToChangeTier(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks().update("myResourceGroup", "myDisk",
new DiskUpdate().withTier("P30"), 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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_update_change_tier.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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"properties": {"tier": "P30"}},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_ChangeTier.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_ChangeTier.json
func ExampleDisksClient_BeginUpdate_updateAManagedDiskToChangeTier() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
Tier: to.Ptr("P30"),
},
}, 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// Tier: to.Ptr("P30"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_ChangeTier.json
*/
async function updateAManagedDiskToChangeTier() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = { tier: "P30" };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_ChangeTier.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
Tier = "P30",
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"creationData": {
"createOption": "Empty"
},
"provisioningState": "Updating",
"tier": "P10",
"propertyUpdatesInProgress": {
"targetTier": "P30"
}
},
"location": "West US",
"name": "myDisk"
}
{
"properties": {
"creationData": {
"createOption": "Empty"
},
"provisioningState": "Succeeded",
"tier": "P30"
},
"location": "West US",
"name": "myDisk"
}
Update a managed disk to disable bursting.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"burstingEnabled": false
}
}
import com.azure.resourcemanager.compute.models.DiskUpdate;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_Update_DisableBursting.json
*/
/**
* Sample code: Update a managed disk to disable bursting.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void updateAManagedDiskToDisableBursting(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks().update("myResourceGroup", "myDisk",
new DiskUpdate().withBurstingEnabled(false), 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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_update_disable_bursting.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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"properties": {"burstingEnabled": False}},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_DisableBursting.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_DisableBursting.json
func ExampleDisksClient_BeginUpdate_updateAManagedDiskToDisableBursting() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
BurstingEnabled: to.Ptr(false),
},
}, 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_DisableBursting.json
*/
async function updateAManagedDiskToDisableBursting() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = { burstingEnabled: false };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_DisableBursting.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
BurstingEnabled = false,
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"creationData": {
"createOption": "Empty"
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "myDisk"
}
{
"properties": {
"creationData": {
"createOption": "Empty"
},
"provisioningState": "Succeeded"
},
"location": "West US",
"name": "myDisk"
}
Update a managed disk to disable optimizedForFrequentAttach.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"optimizedForFrequentAttach": false
}
}
import com.azure.resourcemanager.compute.models.DiskUpdate;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_Update_DisableOptimizedForFrequentAttach.json
*/
/**
* Sample code: Update a managed disk to disable optimizedForFrequentAttach.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
updateAManagedDiskToDisableOptimizedForFrequentAttach(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks().update("myResourceGroup", "myDisk",
new DiskUpdate().withOptimizedForFrequentAttach(false), 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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_update_disable_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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"properties": {"optimizedForFrequentAttach": False}},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json
func ExampleDisksClient_BeginUpdate_updateAManagedDiskToDisableOptimizedForFrequentAttach() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
OptimizedForFrequentAttach: to.Ptr(false),
},
}, 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionEmpty),
// },
// DiskSizeGB: to.Ptr[int32](200),
// OptimizedForFrequentAttach: to.Ptr(false),
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json
*/
async function updateAManagedDiskToDisableOptimizedForFrequentAttach() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = { optimizedForFrequentAttach: false };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
IsOptimizedForFrequentAttach = false,
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating",
"optimizedForFrequentAttach": false
},
"location": "West US",
"name": "myDisk"
}
{
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Succeeded",
"optimizedForFrequentAttach": false
},
"location": "West US",
"name": "myDisk"
}
Update a managed disk with diskControllerTypes.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"supportedCapabilities": {
"diskControllerTypes": "SCSI"
}
}
}
import com.azure.resourcemanager.compute.models.DiskUpdate;
import com.azure.resourcemanager.compute.models.SupportedCapabilities;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_Update_AddDiskControllerTypes.json
*/
/**
* Sample code: Update a managed disk with diskControllerTypes.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void updateAManagedDiskWithDiskControllerTypes(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks().update("myResourceGroup", "myDisk",
new DiskUpdate().withSupportedCapabilities(new SupportedCapabilities().withDiskControllerTypes("SCSI")),
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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_update_add_disk_controller_types.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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"properties": {"supportedCapabilities": {"diskControllerTypes": "SCSI"}}},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.json
func ExampleDisksClient_BeginUpdate_updateAManagedDiskWithDiskControllerTypes() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
SupportedCapabilities: &armcompute.SupportedCapabilities{
DiskControllerTypes: to.Ptr("SCSI"),
},
},
}, 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.DiskProperties{
// CreationData: &armcompute.CreationData{
// CreateOption: to.Ptr(armcompute.DiskCreateOptionFromImage),
// ImageReference: &armcompute.ImageDiskReference{
// ID: to.Ptr("/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/marketplacetestfirstparty/ArtifactTypes/VMImage/Offers/nvme_test_062/Skus/test_sku/Versions/1.0.0"),
// },
// },
// DiskSizeGB: to.Ptr[int32](127),
// HyperVGeneration: to.Ptr(armcompute.HyperVGenerationV1),
// OSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
// ProvisioningState: to.Ptr("Succeeded"),
// SupportedCapabilities: &armcompute.SupportedCapabilities{
// DiskControllerTypes: to.Ptr("SCSI"),
// },
// },
// SKU: &armcompute.DiskSKU{
// Name: to.Ptr(armcompute.DiskStorageAccountTypesStandardLRS),
// Tier: to.Ptr("Standard"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.json
*/
async function updateAManagedDiskWithDiskControllerTypes() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = {
supportedCapabilities: { diskControllerTypes: "SCSI" },
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
SupportedCapabilities = new SupportedCapabilities
{
DiskControllerTypes = "SCSI",
},
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"diskControllerTypes": "SCSI"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/marketplacetestfirstparty/ArtifactTypes/VMImage/Offers/nvme_test_062/Skus/test_sku/Versions/1.0.0"
}
},
"diskSizeGB": 127,
"provisioningState": "Updating"
}
}
{
"name": "myDisk",
"location": "westus",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"osType": "Windows",
"hyperVGeneration": "V1",
"supportedCapabilities": {
"diskControllerTypes": "SCSI"
},
"creationData": {
"createOption": "FromImage",
"imageReference": {
"id": "/Subscriptions/{subscription-id}/Providers/Microsoft.Compute/Locations/westus/Publishers/marketplacetestfirstparty/ArtifactTypes/VMImage/Offers/nvme_test_062/Skus/test_sku/Versions/1.0.0"
}
},
"diskSizeGB": 127,
"provisioningState": "Succeeded"
}
}
Update managed disk to remove disk access resource association.
Esempio di richiesta
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"networkAccessPolicy": "AllowAll"
}
}
import com.azure.resourcemanager.compute.models.DiskUpdate;
import com.azure.resourcemanager.compute.models.NetworkAccessPolicy;
/**
* Samples for Disks Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/
* Disk_Update_RemoveDiskAccess.json
*/
/**
* Sample code: Update managed disk to remove disk access resource association.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
updateManagedDiskToRemoveDiskAccessResourceAssociation(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getDisks().update("myResourceGroup", "myDisk",
new DiskUpdate().withNetworkAccessPolicy(NetworkAccessPolicy.ALLOW_ALL), 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 typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python disk_update_remove_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_update(
resource_group_name="myResourceGroup",
disk_name="myDisk",
disk={"properties": {"networkAccessPolicy": "AllowAll"}},
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.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/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d6d0798c6f5eb196fba7bd1924db2b145a94f58c/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.json
func ExampleDisksClient_BeginUpdate_updateManagedDiskToRemoveDiskAccessResourceAssociation() {
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().BeginUpdate(ctx, "myResourceGroup", "myDisk", armcompute.DiskUpdate{
Properties: &armcompute.DiskUpdateProperties{
NetworkAccessPolicy: to.Ptr(armcompute.NetworkAccessPolicyAllowAll),
},
}, 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 pull 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.Disk = armcompute.Disk{
// Name: to.Ptr("myDisk"),
// 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.NetworkAccessPolicyAllowAll),
// ProvisioningState: to.Ptr("Succeeded"),
// },
// }
}
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");
require("dotenv/config");
/**
* This sample demonstrates how to Updates (patches) a disk.
*
* @summary Updates (patches) a disk.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.json
*/
async function updateManagedDiskToRemoveDiskAccessResourceAssociation() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const diskName = "myDisk";
const disk = { networkAccessPolicy: "AllowAll" };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.disks.beginUpdateAndWait(resourceGroupName, diskName, disk);
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2024-03-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.json
// this example is just showing the usage of "Disks_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ManagedDiskResource created on azure
// for more information of creating ManagedDiskResource, please refer to the document of ManagedDiskResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string diskName = "myDisk";
ResourceIdentifier managedDiskResourceId = ManagedDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, diskName);
ManagedDiskResource managedDisk = client.GetManagedDiskResource(managedDiskResourceId);
// invoke the operation
ManagedDiskPatch patch = new ManagedDiskPatch
{
NetworkAccessPolicy = NetworkAccessPolicy.AllowAll,
};
ArmOperation<ManagedDiskResource> lro = await managedDisk.UpdateAsync(WaitUntil.Completed, patch);
ManagedDiskResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ManagedDiskData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Risposta di esempio
Location: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk?api-version=2024-03-02
{
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Updating",
"networkAccessPolicy": "AllowAll"
},
"location": "West US",
"name": "myDisk"
}
{
"properties": {
"creationData": {
"createOption": "Empty"
},
"diskSizeGB": 200,
"provisioningState": "Succeeded",
"networkAccessPolicy": "AllowAll"
},
"location": "West US",
"name": "myDisk"
}
Definizioni
Nome |
Descrizione |
Architecture
|
Architettura della CPU supportata da un disco del sistema operativo.
|
CreationData
|
Dati usati durante la creazione di un disco.
|
DataAccessAuthMode
|
Requisiti di autenticazione aggiuntivi per l'esportazione o il caricamento in un disco o uno snapshot.
|
Disk
|
Risorsa disco.
|
DiskCreateOption
|
In questo modo vengono enumerate le possibili origini della creazione di un disco.
|
DiskSecurityProfile
|
Contiene le informazioni relative alla sicurezza per la risorsa.
|
DiskSecurityTypes
|
Specifica il Tipo di sicurezza della macchina virtuale. Applicabile solo per i dischi del sistema operativo.
|
DiskSku
|
Nome sku dei dischi. Può essere Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS o PremiumV2_LRS.
|
DiskState
|
In questo modo viene enumerato lo stato possibile del disco.
|
DiskStorageAccountTypes
|
Nome sku.
|
DiskUpdate
|
Risorsa di aggiornamento del disco.
|
Encryption
|
Impostazioni di crittografia dei dati inattivi per disco o snapshot
|
EncryptionSettingsCollection
|
Impostazioni di crittografia per disco o snapshot
|
EncryptionSettingsElement
|
Impostazioni di crittografia per un volume su disco.
|
EncryptionType
|
Tipo di chiave utilizzata per crittografare i dati del disco.
|
ExtendedLocation
|
Tipo complesso della posizione estesa.
|
ExtendedLocationTypes
|
Tipo della posizione estesa.
|
HyperVGeneration
|
Generazione dell'hypervisor della macchina virtuale. Applicabile solo ai dischi del sistema operativo.
|
ImageDiskReference
|
Immagine di origine usata per la creazione del disco.
|
KeyVaultAndKeyReference
|
L'URL della chiave dell'insieme di credenziali delle chiavi e l'ID dell'insieme di credenziali delle chiavi di KeK, KeK è facoltativo e, se specificato, viene usato per annullare il wrapping della chiave di crittografia
|
KeyVaultAndSecretReference
|
URL segreto dell'insieme di credenziali delle chiavi e ID dell'insieme di credenziali della chiave di crittografia
|
NetworkAccessPolicy
|
Criteri per l'accesso al disco tramite rete.
|
OperatingSystemTypes
|
Tipo di sistema operativo.
|
PropertyUpdatesInProgress
|
Proprietà del disco per cui è in sospeso l'aggiornamento.
|
ProvisionedBandwidthCopyOption
|
Se questo campo è impostato su uno snapshot e createOption è CopyStart, lo snapshot verrà copiato con una velocità più rapida.
|
PublicNetworkAccess
|
Criteri per controllare l'esportazione sul disco.
|
PurchasePlan
|
Usato per stabilire il contesto di acquisto di qualsiasi artefatto di terze parti tramite MarketPlace.
|
ShareInfoElement
|
|
SourceVault
|
L'ID dell'insieme di credenziali è un ID risorsa di Azure Resource Manager nel formato /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
|
SupportedCapabilities
|
Elenco delle funzionalità supportate rese persistenti nella risorsa disco per l'uso della macchina virtuale.
|
Architecture
Architettura della CPU supportata da un disco del sistema operativo.
Nome |
Tipo |
Descrizione |
Arm64
|
string
|
|
x64
|
string
|
|
CreationData
Dati usati durante la creazione di un disco.
Nome |
Tipo |
Descrizione |
createOption
|
DiskCreateOption
|
In questo modo vengono enumerate le possibili origini della creazione di un disco.
|
elasticSanResourceId
|
string
|
Obbligatorio se createOption è CopyFromSanSnapshot. Si tratta dell'ID ARM dello snapshot del volume san elastico di origine.
|
galleryImageReference
|
ImageDiskReference
|
Obbligatorio se si crea da un'immagine della raccolta. Id/sharedGalleryImageId/communityGalleryImageId di ImageDiskReference sarà l'ID ARM della versione dell'immagine condivisa da cui creare un disco.
|
imageReference
|
ImageDiskReference
|
Informazioni sull'origine del disco per immagini PIR o utente.
|
logicalSectorSize
|
integer
|
Dimensioni del settore logico in byte per i dischi Ultra. I valori supportati sono 512 annunci 4096. 4096 è l'impostazione predefinita.
|
performancePlus
|
boolean
|
Impostare questo flag su true per ottenere un aumento della destinazione delle prestazioni del disco distribuito, vedere qui nella rispettiva destinazione delle prestazioni. Questo flag può essere impostato solo in fase di creazione del disco e non può essere disabilitato dopo l'abilitazione.
|
provisionedBandwidthCopySpeed
|
ProvisionedBandwidthCopyOption
|
Se questo campo è impostato su uno snapshot e createOption è CopyStart, lo snapshot verrà copiato con una velocità più rapida.
|
securityDataUri
|
string
|
Se createOption è ImportSecure, si tratta dell'URI di un BLOB da importare nello stato guest della macchina virtuale.
|
sourceResourceId
|
string
|
Se createOption è Copy, si tratta dell'ID ARM dello snapshot o del disco di origine.
|
sourceUniqueId
|
string
|
Se questo campo è impostato, si tratta dell'ID univoco che identifica l'origine della risorsa.
|
sourceUri
|
string
|
Se createOption è Import, si tratta dell'URI di un BLOB da importare in un disco gestito.
|
storageAccountId
|
string
|
Obbligatorio se createOption è Import. Identificatore di Azure Resource Manager dell'account di archiviazione contenente il BLOB da importare come disco.
|
uploadSizeBytes
|
integer
|
Se createOption è Upload, si tratta delle dimensioni del contenuto del caricamento, incluso il piè di pagina del disco rigido virtuale. Questo valore deve essere compreso tra 20972032 (20 MiB + 512 byte per il piè di pagina del disco rigido virtuale) e 35183298347520 byte (32 TiB + 512 byte per il piè di pagina del disco rigido virtuale).
|
DataAccessAuthMode
Requisiti di autenticazione aggiuntivi per l'esportazione o il caricamento in un disco o uno snapshot.
Nome |
Tipo |
Descrizione |
AzureActiveDirectory
|
string
|
Quando si usa l'URL di esportazione/caricamento, il sistema controlla se l'utente ha un'identità in Azure Active Directory e dispone delle autorizzazioni necessarie per esportare/caricare i dati. Fare riferimento a aka.ms/DisksAzureADAuth.
|
None
|
string
|
Non viene eseguita alcuna autenticazione aggiuntiva quando si accede all'URL di esportazione/caricamento.
|
Disk
Risorsa disco.
Nome |
Tipo |
Descrizione |
extendedLocation
|
ExtendedLocation
|
Percorso esteso in cui verrà creato il disco. Impossibile modificare la posizione estesa.
|
id
|
string
|
ID risorsa
|
location
|
string
|
Percorso risorsa
|
managedBy
|
string
|
URI relativo contenente l'ID della macchina virtuale con il disco collegato.
|
managedByExtended
|
string[]
|
Elenco di URI relativi contenenti gli ID delle macchine virtuali collegate al disco. maxShares deve essere impostato su un valore maggiore di uno per i dischi per consentire il collegamento a più macchine virtuali.
|
name
|
string
|
Nome risorsa
|
properties.LastOwnershipUpdateTime
|
string
|
Ora UTC in cui lo stato di proprietà del disco è stato modificato per l'ultima volta, ovvero l'ora in cui il disco è stato collegato o scollegato da una macchina virtuale o l'ora in cui la macchina virtuale a cui è stato collegato il disco è stata deallocata o avviata.
|
properties.burstingEnabled
|
boolean
|
Impostare su true per abilitare il bursting oltre la destinazione delle prestazioni con provisioning del disco. Il bursting è disabilitato per impostazione predefinita. Non si applica ai dischi Ultra.
|
properties.burstingEnabledTime
|
string
|
Ora più recente in cui il bursting è stato abilitato per l'ultima volta in un disco.
|
properties.completionPercent
|
number
|
Percentuale di completamento per la copia in background quando viene creata una risorsa tramite l'operazione CopyStart.
|
properties.creationData
|
CreationData
|
Informazioni sull'origine del disco. Le informazioni creationData non possono essere modificate dopo la creazione del disco.
|
properties.dataAccessAuthMode
|
DataAccessAuthMode
|
Requisiti di autenticazione aggiuntivi per l'esportazione o il caricamento in un disco o uno snapshot.
|
properties.diskAccessId
|
string
|
ID ARM della risorsa DiskAccess per l'uso di endpoint privati su dischi.
|
properties.diskIOPSReadOnly
|
integer
|
Numero totale di operazioni di I/O al secondo consentite in tutte le macchine virtuali che montano il disco condiviso come ReadOnly. Un'operazione può trasferire tra 4k e 256.000 byte.
|
properties.diskIOPSReadWrite
|
integer
|
Numero di operazioni di I/O al secondo consentite per questo disco; solo impostabile per i dischi UltraSSD. Un'operazione può trasferire tra 4k e 256.000 byte.
|
properties.diskMBpsReadOnly
|
integer
|
Velocità effettiva totale (MBps) che sarà consentita in tutte le macchine virtuali che montano il disco condiviso come ReadOnly. MBps significa milioni di byte al secondo - MB qui usa la notazione ISO, di poteri di 10.
|
properties.diskMBpsReadWrite
|
integer
|
Larghezza di banda consentita per questo disco; solo impostabile per i dischi UltraSSD. MBps significa milioni di byte al secondo - MB qui usa la notazione ISO, di poteri di 10.
|
properties.diskSizeBytes
|
integer
|
Dimensioni del disco in byte. Questo campo è di sola lettura.
|
properties.diskSizeGB
|
integer
|
Se creationData.createOption è Vuoto, questo campo è obbligatorio e indica le dimensioni del disco da creare. Se questo campo è presente per gli aggiornamenti o la creazione con altre opzioni, indica un ridimensionamento. I ridimensionamenti sono consentiti solo se il disco non è collegato a una macchina virtuale in esecuzione e può aumentare solo le dimensioni del disco.
|
properties.diskState
|
DiskState
|
Stato del disco.
|
properties.encryption
|
Encryption
|
La proprietà di crittografia può essere usata per crittografare i dati inattivi con chiavi gestite dal cliente o chiavi gestite dalla piattaforma.
|
properties.encryptionSettingsCollection
|
EncryptionSettingsCollection
|
La raccolta di impostazioni di crittografia usata per Crittografia dischi di Azure può contenere più impostazioni di crittografia per disco o snapshot.
|
properties.hyperVGeneration
|
HyperVGeneration
|
Generazione dell'hypervisor della macchina virtuale. Applicabile solo ai dischi del sistema operativo.
|
properties.maxShares
|
integer
|
Numero massimo di macchine virtuali che possono essere collegate al disco contemporaneamente. Il valore maggiore di uno indica un disco che può essere montato in più macchine virtuali contemporaneamente.
|
properties.networkAccessPolicy
|
NetworkAccessPolicy
|
Criteri per l'accesso al disco tramite rete.
|
properties.optimizedForFrequentAttach
|
boolean
|
L'impostazione di questa proprietà su true migliora l'affidabilità e le prestazioni dei dischi dati che sono spesso (più di 5 volte al giorno) scollegati da una macchina virtuale e collegati a un altro. Questa proprietà non deve essere impostata per i dischi non scollegati e collegati frequentemente perché i dischi non sono allineati al dominio di errore della macchina virtuale.
|
properties.osType
|
OperatingSystemTypes
|
Tipo di sistema operativo.
|
properties.propertyUpdatesInProgress
|
PropertyUpdatesInProgress
|
Proprietà del disco per cui è in sospeso l'aggiornamento.
|
properties.provisioningState
|
string
|
Stato di provisioning del disco.
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
Criteri per controllare l'esportazione sul disco.
|
properties.purchasePlan
|
PurchasePlan
|
Informazioni sul piano di acquisto per l'immagine da cui è stato creato il disco del sistema operativo. Ad esempio: {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer}
|
properties.securityProfile
|
DiskSecurityProfile
|
Contiene le informazioni relative alla sicurezza per la risorsa.
|
properties.shareInfo
|
ShareInfoElement[]
|
Dettagli dell'elenco di tutte le macchine virtuali in cui è collegato il disco. maxShares deve essere impostato su un valore maggiore di uno per i dischi per consentire il collegamento a più macchine virtuali.
|
properties.supportedCapabilities
|
SupportedCapabilities
|
Elenco delle funzionalità supportate per l'immagine da cui è stato creato il disco del sistema operativo.
|
properties.supportsHibernation
|
boolean
|
Indica che il sistema operativo in un disco supporta l'ibernazione.
|
properties.tier
|
string
|
Livello di prestazioni del disco ,ad esempio P4, S10, come descritto di seguito: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Non si applica ai dischi Ultra.
|
properties.timeCreated
|
string
|
Ora di creazione del disco.
|
properties.uniqueId
|
string
|
Guid univoco che identifica la risorsa.
|
sku
|
DiskSku
|
Nome sku dei dischi. Può essere Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS o PremiumV2_LRS.
|
tags
|
object
|
Tag delle risorse
|
type
|
string
|
Tipo di risorsa
|
zones
|
string[]
|
Elenco di zone logiche per Disco.
|
DiskCreateOption
In questo modo vengono enumerate le possibili origini della creazione di un disco.
Nome |
Tipo |
Descrizione |
Attach
|
string
|
Il disco verrà collegato a una macchina virtuale.
|
Copy
|
string
|
Creare un nuovo disco o uno snapshot copiando da un disco o uno snapshot specificato da sourceResourceId specificato.
|
CopyFromSanSnapshot
|
string
|
Creare un nuovo disco esportando dallo snapshot del volume san elastico
|
CopyStart
|
string
|
Creare un nuovo disco usando un processo di copia completa, in cui la creazione della risorsa viene considerata completa solo dopo che tutti i dati sono stati copiati dall'origine.
|
Empty
|
string
|
Creare un disco dati vuoto di una dimensione specificata da diskSizeGB.
|
FromImage
|
string
|
Creare un nuovo disco da un'immagine della piattaforma specificata dall'immagine SpecificataReference o galleryImageReference.
|
Import
|
string
|
Creare un disco importando da un BLOB specificato da un sourceUri in un account di archiviazione specificato da storageAccountId.
|
ImportSecure
|
string
|
Analogamente all'opzione Di importazione crea. Creare una nuova macchina virtuale di avvio attendibile o un disco riservato supportato importando un BLOB aggiuntivo per lo stato guest della macchina virtuale specificato da securityDataUri nell'account di archiviazione specificato da storageAccountId
|
Restore
|
string
|
Creare un nuovo disco copiando da un punto di ripristino di backup.
|
Upload
|
string
|
Creare un nuovo disco ottenendo un token di scrittura e usandolo per caricare direttamente il contenuto del disco.
|
UploadPreparedSecure
|
string
|
Analogamente all'opzione Carica crea. Creare una nuova macchina virtuale di avvio attendibile o un disco riservato supportato e caricare usando il token di scrittura sia nello stato del disco che del guest della macchina virtuale
|
DiskSecurityProfile
Contiene le informazioni relative alla sicurezza per la risorsa.
Nome |
Tipo |
Descrizione |
secureVMDiskEncryptionSetId
|
string
|
ResourceId del set di crittografia del disco associato a Confidential VM supported disk encrypted with customer managed key
|
securityType
|
DiskSecurityTypes
|
Specifica il Tipo di sicurezza della macchina virtuale. Applicabile solo per i dischi del sistema operativo.
|
DiskSecurityTypes
Specifica il Tipo di sicurezza della macchina virtuale. Applicabile solo per i dischi del sistema operativo.
Nome |
Tipo |
Descrizione |
ConfidentialVM_DiskEncryptedWithCustomerKey
|
string
|
Indica un disco di macchina virtuale riservato con disco del sistema operativo e stato guest della macchina virtuale crittografato con una chiave gestita dal cliente
|
ConfidentialVM_DiskEncryptedWithPlatformKey
|
string
|
Indica un disco di macchina virtuale riservato con disco del sistema operativo e stato guest della macchina virtuale crittografato con una chiave gestita dalla piattaforma
|
ConfidentialVM_NonPersistedTPM
|
string
|
Indica un disco di macchina virtuale riservato con un vTPM temporaneo. Lo stato vTPM non viene salvato in modo permanente tra i riavvii della macchina virtuale.
|
ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey
|
string
|
Indica il disco di macchina virtuale riservato con solo lo stato guest della macchina virtuale crittografato
|
TrustedLaunch
|
string
|
Avvio attendibile offre funzionalità di sicurezza come l'avvio protetto e il virtual Trusted Platform Module (vTPM)
|
DiskSku
Nome sku dei dischi. Può essere Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS o PremiumV2_LRS.
DiskState
In questo modo viene enumerato lo stato possibile del disco.
Nome |
Tipo |
Descrizione |
ActiveSAS
|
string
|
Al disco è attualmente associato un URI di firma di accesso condiviso attivo.
|
ActiveSASFrozen
|
string
|
Il disco è collegato a una macchina virtuale in stato di ibernazione e ha un URI di firma di accesso condiviso attivo associato.
|
ActiveUpload
|
string
|
Viene creato un disco per il caricamento e viene rilasciato un token di scrittura per il caricamento.
|
Attached
|
string
|
Il disco è attualmente collegato a una macchina virtuale in esecuzione.
|
Frozen
|
string
|
Il disco è collegato a una macchina virtuale in stato di ibernazione.
|
ReadyToUpload
|
string
|
Un disco è pronto per essere creato tramite il caricamento richiedendo un token di scrittura.
|
Reserved
|
string
|
Il disco è collegato a una macchina virtuale arrestata deallocata.
|
Unattached
|
string
|
Il disco non viene usato e può essere collegato a una macchina virtuale.
|
DiskStorageAccountTypes
Nome sku.
Nome |
Tipo |
Descrizione |
PremiumV2_LRS
|
string
|
Archiviazione con ridondanza locale di SSD Premium v2. Ideale per carichi di lavoro sensibili alle prestazioni e di produzione che richiedono costantemente bassa latenza e operazioni di I/O al secondo e velocità effettiva elevate.
|
Premium_LRS
|
string
|
Archiviazione con ridondanza locale ssd Premium. Ideale per carichi di lavoro sensibili alla produzione e alle prestazioni.
|
Premium_ZRS
|
string
|
Archiviazione con ridondanza della zona SSD Premium. Ideale per i carichi di lavoro di produzione che necessitano di resilienza di archiviazione in caso di errori di zona.
|
StandardSSD_LRS
|
string
|
Archiviazione ssd standard con ridondanza locale. Ideale per i server Web, usate in modo leggero applicazioni aziendali e sviluppo/test.
|
StandardSSD_ZRS
|
string
|
Archiviazione con ridondanza della zona SSD Standard. Ideale per i server Web, usate in modo leggero applicazioni aziendali e sviluppo/test che necessitano di resilienza di archiviazione in caso di errori di zona.
|
Standard_LRS
|
string
|
Archiviazione hdd standard con ridondanza locale. Ideale per l'accesso di backup, non critico e poco frequente.
|
UltraSSD_LRS
|
string
|
Archiviazione ultra SSD con ridondanza locale. Ideale per carichi di lavoro con utilizzo intensivo di I/O, ad esempio SAP HANA, database di livello superiore (ad esempio, SQL, Oracle) e altri carichi di lavoro con elevato carico di lavoro delle transazioni.
|
DiskUpdate
Risorsa di aggiornamento del disco.
Nome |
Tipo |
Descrizione |
properties.burstingEnabled
|
boolean
|
Impostare su true per abilitare il bursting oltre la destinazione delle prestazioni con provisioning del disco. Il bursting è disabilitato per impostazione predefinita. Non si applica ai dischi Ultra.
|
properties.dataAccessAuthMode
|
DataAccessAuthMode
|
Requisiti di autenticazione aggiuntivi per l'esportazione o il caricamento in un disco o uno snapshot.
|
properties.diskAccessId
|
string
|
ID ARM della risorsa DiskAccess per l'uso di endpoint privati su dischi.
|
properties.diskIOPSReadOnly
|
integer
|
Numero totale di operazioni di I/O al secondo consentite in tutte le macchine virtuali che montano il disco condiviso come ReadOnly. Un'operazione può trasferire tra 4k e 256.000 byte.
|
properties.diskIOPSReadWrite
|
integer
|
Numero di operazioni di I/O al secondo consentite per questo disco; solo impostabile per i dischi UltraSSD. Un'operazione può trasferire tra 4k e 256.000 byte.
|
properties.diskMBpsReadOnly
|
integer
|
Velocità effettiva totale (MBps) che sarà consentita in tutte le macchine virtuali che montano il disco condiviso come ReadOnly. MBps significa milioni di byte al secondo - MB qui usa la notazione ISO, di poteri di 10.
|
properties.diskMBpsReadWrite
|
integer
|
Larghezza di banda consentita per questo disco; solo impostabile per i dischi UltraSSD. MBps significa milioni di byte al secondo - MB qui usa la notazione ISO, di poteri di 10.
|
properties.diskSizeGB
|
integer
|
Se creationData.createOption è Vuoto, questo campo è obbligatorio e indica le dimensioni del disco da creare. Se questo campo è presente per gli aggiornamenti o la creazione con altre opzioni, indica un ridimensionamento. I ridimensionamenti sono consentiti solo se il disco non è collegato a una macchina virtuale in esecuzione e può aumentare solo le dimensioni del disco.
|
properties.encryption
|
Encryption
|
La proprietà di crittografia può essere usata per crittografare i dati inattivi con chiavi gestite dal cliente o chiavi gestite dalla piattaforma.
|
properties.encryptionSettingsCollection
|
EncryptionSettingsCollection
|
La raccolta di impostazioni di crittografia usata è Crittografia dischi di Azure, può contenere più impostazioni di crittografia per disco o snapshot.
|
properties.maxShares
|
integer
|
Numero massimo di macchine virtuali che possono essere collegate al disco contemporaneamente. Il valore maggiore di uno indica un disco che può essere montato in più macchine virtuali contemporaneamente.
|
properties.networkAccessPolicy
|
NetworkAccessPolicy
|
Criteri per l'accesso al disco tramite rete.
|
properties.optimizedForFrequentAttach
|
boolean
|
L'impostazione di questa proprietà su true migliora l'affidabilità e le prestazioni dei dischi dati che sono spesso (più di 5 volte al giorno) scollegati da una macchina virtuale e collegati a un altro. Questa proprietà non deve essere impostata per i dischi non scollegati e collegati frequentemente perché i dischi non sono allineati al dominio di errore della macchina virtuale.
|
properties.osType
|
OperatingSystemTypes
|
tipo di sistema operativo.
|
properties.propertyUpdatesInProgress
|
PropertyUpdatesInProgress
|
Proprietà del disco per cui è in sospeso l'aggiornamento.
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
Criteri per controllare l'esportazione sul disco.
|
properties.purchasePlan
|
PurchasePlan
|
Informazioni sul piano di acquisto da aggiungere sul disco del sistema operativo
|
properties.supportedCapabilities
|
SupportedCapabilities
|
Elenco delle funzionalità supportate da aggiungere sul disco del sistema operativo.
|
properties.supportsHibernation
|
boolean
|
Indica che il sistema operativo in un disco supporta l'ibernazione.
|
properties.tier
|
string
|
Livello di prestazioni del disco ,ad esempio P4, S10, come descritto di seguito: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Non si applica ai dischi Ultra.
|
sku
|
DiskSku
|
Nome sku dei dischi. Può essere Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS o PremiumV2_LRS.
|
tags
|
object
|
Tag delle risorse
|
Encryption
Impostazioni di crittografia dei dati inattivi per disco o snapshot
Nome |
Tipo |
Descrizione |
diskEncryptionSetId
|
string
|
ResourceId del set di crittografia del disco da usare per abilitare la crittografia dei dati inattivi.
|
type
|
EncryptionType
|
Tipo di chiave utilizzata per crittografare i dati del disco.
|
EncryptionSettingsCollection
Impostazioni di crittografia per disco o snapshot
Nome |
Tipo |
Descrizione |
enabled
|
boolean
|
Impostare questo flag su true e specificare DiskEncryptionKey e keyEncryptionKey facoltativo per abilitare la crittografia. Impostare questo flag su false e rimuovere DiskEncryptionKey e KeyEncryptionKey per disabilitare la crittografia. Se EncryptionSettings è Null nell'oggetto richiesta, le impostazioni esistenti rimangono invariate.
|
encryptionSettings
|
EncryptionSettingsElement[]
|
Raccolta di impostazioni di crittografia, una per ogni volume del disco.
|
encryptionSettingsVersion
|
string
|
Descrive il tipo di crittografia usato per i dischi. Dopo aver impostato questo campo, non può essere sovrascritto. '1.0' corrisponde a Crittografia dischi di Azure con l'app AAD.'1.1' corrisponde a Crittografia dischi di Azure.
|
EncryptionSettingsElement
Impostazioni di crittografia per un volume su disco.
Nome |
Tipo |
Descrizione |
diskEncryptionKey
|
KeyVaultAndSecretReference
|
URL segreto dell'insieme di credenziali delle chiavi e ID dell'insieme di credenziali della chiave di crittografia del disco
|
keyEncryptionKey
|
KeyVaultAndKeyReference
|
URL della chiave dell'insieme di credenziali delle chiavi e ID dell'insieme di credenziali della chiave. KeyEncryptionKey è facoltativo e, se specificato, viene usato per annullare il wrapping della chiave di crittografia del disco.
|
EncryptionType
Tipo di chiave utilizzata per crittografare i dati del disco.
Nome |
Tipo |
Descrizione |
EncryptionAtRestWithCustomerKey
|
string
|
Il disco viene crittografato inattivo con la chiave gestita dal cliente che può essere modificata e revocata da un cliente.
|
EncryptionAtRestWithPlatformAndCustomerKeys
|
string
|
Il disco viene crittografato inattivo con 2 livelli di crittografia. Una delle chiavi è Gestita dal cliente e l'altra è gestita dalla piattaforma.
|
EncryptionAtRestWithPlatformKey
|
string
|
Il disco viene crittografato inattivo con la chiave gestita della piattaforma. È il tipo di crittografia predefinito. Questo non è un tipo di crittografia valido per i set di crittografia dischi.
|
ExtendedLocation
Tipo complesso della posizione estesa.
Nome |
Tipo |
Descrizione |
name
|
string
|
Nome della posizione estesa.
|
type
|
ExtendedLocationTypes
|
Tipo della posizione estesa.
|
ExtendedLocationTypes
Tipo della posizione estesa.
Nome |
Tipo |
Descrizione |
EdgeZone
|
string
|
|
HyperVGeneration
Generazione dell'hypervisor della macchina virtuale. Applicabile solo ai dischi del sistema operativo.
Nome |
Tipo |
Descrizione |
V1
|
string
|
|
V2
|
string
|
|
ImageDiskReference
Immagine di origine usata per la creazione del disco.
Nome |
Tipo |
Descrizione |
communityGalleryImageId
|
string
|
URI relativo contenente un riferimento all'immagine della raccolta di calcolo di Azure della community.
|
id
|
string
|
URI relativo contenente un repository di immagini della piattaforma, un'immagine utente o un riferimento all'immagine della raccolta di calcolo di Azure.
|
lun
|
integer
|
Se il disco viene creato dal disco dati di un'immagine, si tratta di un indice che indica quale dei dischi dati nell'immagine usare. Per i dischi del sistema operativo, questo campo è Null.
|
sharedGalleryImageId
|
string
|
URI relativo contenente un riferimento diretto all'immagine della raccolta di calcolo di Azure condivisa.
|
KeyVaultAndKeyReference
L'URL della chiave dell'insieme di credenziali delle chiavi e l'ID dell'insieme di credenziali delle chiavi di KeK, KeK è facoltativo e, se specificato, viene usato per annullare il wrapping della chiave di crittografia
Nome |
Tipo |
Descrizione |
keyUrl
|
string
|
URL che punta a una chiave o a un segreto in KeyVault
|
sourceVault
|
SourceVault
|
ID risorsa dell'insieme di credenziali delle chiavi contenente la chiave o il segreto
|
KeyVaultAndSecretReference
URL segreto dell'insieme di credenziali delle chiavi e ID dell'insieme di credenziali della chiave di crittografia
Nome |
Tipo |
Descrizione |
secretUrl
|
string
|
URL che punta a una chiave o a un segreto in KeyVault
|
sourceVault
|
SourceVault
|
ID risorsa dell'insieme di credenziali delle chiavi contenente la chiave o il segreto
|
NetworkAccessPolicy
Criteri per l'accesso al disco tramite rete.
Nome |
Tipo |
Descrizione |
AllowAll
|
string
|
Il disco può essere esportato o caricato in da qualsiasi rete.
|
AllowPrivate
|
string
|
Il disco può essere esportato o caricato in usando gli endpoint privati di una risorsa DiskAccess.
|
DenyAll
|
string
|
Impossibile esportare il disco.
|
OperatingSystemTypes
Tipo di sistema operativo.
Nome |
Tipo |
Descrizione |
Linux
|
string
|
|
Windows
|
string
|
|
PropertyUpdatesInProgress
Proprietà del disco per cui è in sospeso l'aggiornamento.
Nome |
Tipo |
Descrizione |
targetTier
|
string
|
Livello di prestazioni di destinazione del disco se è in corso un'operazione di modifica del livello.
|
ProvisionedBandwidthCopyOption
Se questo campo è impostato su uno snapshot e createOption è CopyStart, lo snapshot verrà copiato con una velocità più rapida.
Nome |
Tipo |
Descrizione |
Enhanced
|
string
|
|
None
|
string
|
|
PublicNetworkAccess
Criteri per controllare l'esportazione sul disco.
Nome |
Tipo |
Descrizione |
Disabled
|
string
|
Non è possibile accedere pubblicamente ai dati sottostanti del disco su Internet anche quando NetworkAccessPolicy è impostato su AllowAll. È possibile accedere ai dati tramite l'URI di firma di accesso condiviso solo dalla rete virtuale di Azure attendibile quando NetworkAccessPolicy è impostato su AllowPrivate.
|
Enabled
|
string
|
È possibile generare un URI di firma di accesso condiviso per accedere pubblicamente ai dati sottostanti del disco su Internet quando NetworkAccessPolicy è impostato su AllowAll. È possibile accedere ai dati tramite l'URI di firma di accesso condiviso solo dalla rete virtuale di Azure attendibile quando NetworkAccessPolicy è impostato su AllowPrivate.
|
PurchasePlan
Usato per stabilire il contesto di acquisto di qualsiasi artefatto di terze parti tramite MarketPlace.
Nome |
Tipo |
Descrizione |
name
|
string
|
ID del piano.
|
product
|
string
|
Specifica il prodotto dell'immagine dal marketplace. Si tratta dello stesso valore di Offer nell'elemento imageReference.
|
promotionCode
|
string
|
Codice promozionale dell'offerta.
|
publisher
|
string
|
ID editore.
|
ShareInfoElement
Nome |
Tipo |
Descrizione |
vmUri
|
string
|
URI relativo contenente l'ID della macchina virtuale con il disco collegato.
|
SourceVault
L'ID dell'insieme di credenziali è un ID risorsa di Azure Resource Manager nel formato /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
Nome |
Tipo |
Descrizione |
id
|
string
|
ID risorsa
|
SupportedCapabilities
Elenco delle funzionalità supportate rese persistenti nella risorsa disco per l'uso della macchina virtuale.
Nome |
Tipo |
Descrizione |
acceleratedNetwork
|
boolean
|
True se l'immagine da cui viene creato il disco del sistema operativo supporta la rete accelerata.
|
architecture
|
Architecture
|
Architettura della CPU supportata da un disco del sistema operativo.
|
diskControllerTypes
|
string
|
Controller del disco supportati da un disco del sistema operativo. Se impostato, può essere SCSI o SCSI, NVME o NVME, SCSI.
|