Обновляет диск (исправления).
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}?api-version=2024-03-02
Параметры URI
Имя |
В |
Обязательно |
Тип |
Описание |
diskName
|
path |
True
|
string
|
Имя создаваемого управляемого диска. Имя нельзя изменить после создания диска. Поддерживаемые символы для имени: a-z, A-Z, 0-9, _ и -. Максимальная длина имени — 80 символов.
|
resourceGroupName
|
path |
True
|
string
|
Имя группы ресурсов.
|
subscriptionId
|
path |
True
|
string
|
Учетные данные подписки, которые однозначно определяют подписку Microsoft Azure. Идентификатор подписки входит в состав URI для каждого вызова службы.
|
api-version
|
query |
True
|
string
|
Версия клиентского API.
|
Текст запроса
Имя |
Тип |
Описание |
properties.burstingEnabled
|
boolean
|
Задайте значение true, чтобы включить ускорение за пределами подготовленного целевого объекта производительности диска. Ускорение по умолчанию отключено. Не применяется к дискам Категории "Ультра".
|
properties.dataAccessAuthMode
|
DataAccessAuthMode
|
Дополнительные требования к проверке подлинности при экспорте или отправке на диск или моментальный снимок.
|
properties.diskAccessId
|
string
|
Идентификатор ARM ресурса DiskAccess для использования частных конечных точек на дисках.
|
properties.diskIOPSReadOnly
|
integer
|
Общее количество операций ввода-вывода в секунду, которое будет разрешено во всех виртуальных машинах, которые будут подключать общий диск как ReadOnly. Одна операция может передаваться между 4k и 256 кб байтами.
|
properties.diskIOPSReadWrite
|
integer
|
Количество операций ввода-вывода в секунду, разрешенных для этого диска; только для дисков UltraSSD. Одна операция может передаваться между 4k и 256 кб байтами.
|
properties.diskMBpsReadOnly
|
integer
|
Общая пропускная способность (MBps), которая будет разрешена для всех виртуальных машин, которые будут подключать общий диск как ReadOnly. MBps означает миллионы байтов в секунду - МБ здесь использует нотацию ISO, полномочия из 10.
|
properties.diskMBpsReadWrite
|
integer
|
Пропускная способность, разрешенная для этого диска; только для дисков UltraSSD. MBps означает миллионы байтов в секунду - МБ здесь использует нотацию ISO, полномочия из 10.
|
properties.diskSizeGB
|
integer
|
Если createData.createOption является пустым, это поле является обязательным и указывает размер создаваемого диска. Если это поле присутствует для обновлений или создания с другими параметрами, оно указывает на изменение размера. Изменение размера допускается только в том случае, если диск не подключен к работающей виртуальной машине и может увеличить размер диска.
|
properties.encryption
|
Encryption
|
Свойство шифрования можно использовать для шифрования неактивных данных с помощью управляемых клиентом ключей или управляемых платформой ключей.
|
properties.encryptionSettingsCollection
|
EncryptionSettingsCollection
|
Коллекция параметров шифрования, используемая для шифрования дисков Azure, может содержать несколько параметров шифрования на диск или моментальный снимок.
|
properties.maxShares
|
integer
|
Максимальное количество виртуальных машин, которые могут подключаться к диску одновременно. Значение больше одного указывает на диск, который может быть подключен на нескольких виртуальных машинах одновременно.
|
properties.networkAccessPolicy
|
NetworkAccessPolicy
|
Политика доступа к диску через сеть.
|
properties.optimizedForFrequentAttach
|
boolean
|
При установке этого свойства значение true повышает надежность и производительность дисков данных, которые часто (более 5 раз в день) отсоединяются от одной виртуальной машины и подключены к другой. Это свойство не должно быть задано для дисков, которые не отсоединяются и подключаются часто, так как диски не соответствуют домену сбоя виртуальной машины.
|
properties.osType
|
OperatingSystemTypes
|
Тип операционной системы.
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
Политика управления экспортом на диске.
|
properties.purchasePlan
|
PurchasePlan
|
Сведения о плане покупки, которые нужно добавить на диск ОС
|
properties.supportedCapabilities
|
SupportedCapabilities
|
Список поддерживаемых возможностей, которые необходимо добавить на диск ОС.
|
properties.supportsHibernation
|
boolean
|
Указывает, что ОС на диске поддерживает гибернацию.
|
properties.tier
|
string
|
Уровень производительности диска (например, P4, S10), как описано здесь: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Не применяется к дискам Категории "Ультра".
|
sku
|
DiskSku
|
Имя SKU дисков. Можно Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS или PremiumV2_LRS.
|
tags
|
object
|
Теги ресурсов
|
Ответы
Имя |
Тип |
Описание |
200 OK
|
Disk
|
ХОРОШО
|
202 Accepted
|
Disk
|
Принятый
|
Безопасность
azure_auth
Поток OAuth2 Azure Active Directory
Тип:
oauth2
Flow:
implicit
URL-адрес авторизации:
https://login.microsoftonline.com/common/oauth2/authorize
Области
Имя |
Описание |
user_impersonation
|
олицетворения учетной записи пользователя
|
Примеры
Create or update a bursting enabled managed disk.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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.
Образец запроса
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
Пример ответа
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"
}
Определения
Имя |
Описание |
Architecture
|
Архитектура ЦП, поддерживаемая диском ОС.
|
CreationData
|
Данные, используемые при создании диска.
|
DataAccessAuthMode
|
Дополнительные требования к проверке подлинности при экспорте или отправке на диск или моментальный снимок.
|
Disk
|
Дисковый ресурс.
|
DiskCreateOption
|
Это перечисляет возможные источники создания диска.
|
DiskSecurityProfile
|
Содержит сведения, связанные с безопасностью для ресурса.
|
DiskSecurityTypes
|
Указывает тип безопасности виртуальной машины. Применимо только для дисков ОС.
|
DiskSku
|
Имя SKU дисков. Можно Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS или PremiumV2_LRS.
|
DiskState
|
Это перечисляет возможное состояние диска.
|
DiskStorageAccountTypes
|
Имя SKU.
|
DiskUpdate
|
Ресурс обновления диска.
|
Encryption
|
Параметры шифрования неактивных данных для диска или моментального снимка
|
EncryptionSettingsCollection
|
Параметры шифрования для диска или моментального снимка
|
EncryptionSettingsElement
|
Параметры шифрования для одного тома диска.
|
EncryptionType
|
Тип ключа, используемого для шифрования данных диска.
|
ExtendedLocation
|
Сложный тип расширенного расположения.
|
ExtendedLocationTypes
|
Тип расширенного расположения.
|
HyperVGeneration
|
Создание гипервизора виртуальной машины. Применимо только к дискам ОС.
|
ImageDiskReference
|
Исходный образ, используемый для создания диска.
|
KeyVaultAndKeyReference
|
Url-адрес ключа Key Vault и идентификатор хранилища KeK, KeK является необязательным и при использовании для распаковки ключа шифрования
|
KeyVaultAndSecretReference
|
Url-адрес секрета Key Vault и идентификатор хранилища ключа шифрования
|
NetworkAccessPolicy
|
Политика доступа к диску через сеть.
|
OperatingSystemTypes
|
Тип операционной системы.
|
PropertyUpdatesInProgress
|
Свойства диска, для которого ожидается обновление.
|
ProvisionedBandwidthCopyOption
|
Если это поле установлено на моментальном снимке и createOption — CopyStart, моментальный снимок будет скопирован быстрее.
|
PublicNetworkAccess
|
Политика управления экспортом на диске.
|
PurchasePlan
|
Используется для установления контекста покупки любого 3-го стороннего артефакта через MarketPlace.
|
ShareInfoElement
|
|
SourceVault
|
Идентификатор хранилища — это идентификатор ресурса Azure Resource Manager в форме /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
|
SupportedCapabilities
|
Список поддерживаемых возможностей, сохраненных на ресурсе диска для использования виртуальной машины.
|
Architecture
Enumeration
Архитектура ЦП, поддерживаемая диском ОС.
Значение |
Описание |
Arm64
|
|
x64
|
|
CreationData
Object
Данные, используемые при создании диска.
Имя |
Тип |
Описание |
createOption
|
DiskCreateOption
|
Это перечисляет возможные источники создания диска.
|
elasticSanResourceId
|
string
|
Требуется, если createOption — CopyFromSanSnapshot. Это идентификатор ARM исходного моментального снимка эластичного сан-тома.
|
galleryImageReference
|
ImageDiskReference
|
Требуется при создании из образа коллекции. Идентификатор/sharedGalleryImageId/communityGalleryImageId объекта ImageDiskReference будет идентификатором ARM общей версии образа галли, из которой создается диск.
|
imageReference
|
ImageDiskReference
|
Сведения о источнике диска для образов ПИР или пользователей.
|
logicalSectorSize
|
integer
|
Размер логического сектора в байтах для дисков Категории "Ультра". Поддерживаемые значения : 512 ad 4096. 4096 — это значение по умолчанию.
|
performancePlus
|
boolean
|
Задайте для этого флага значение true, чтобы повысить производительность целевого объекта развернутого диска, см. здесь по соответствующему целевому объекту производительности. Этот флаг можно задать только во время создания диска и не может быть отключен после включения.
|
provisionedBandwidthCopySpeed
|
ProvisionedBandwidthCopyOption
|
Если это поле установлено на моментальном снимке и createOption — CopyStart, моментальный снимок будет скопирован быстрее.
|
securityDataUri
|
string
|
Если createOption — ImportSecure, это универсальный код ресурса (URI) большого двоичного объекта, импортируемого в гостевой состояние виртуальной машины.
|
sourceResourceId
|
string
|
Если createOption — Copy, это идентификатор ARM исходного моментального снимка или диска.
|
sourceUniqueId
|
string
|
Если это поле задано, это уникальный идентификатор, определяющий источник этого ресурса.
|
sourceUri
|
string
|
Если createOption — Import, это универсальный код ресурса (URI) большого двоичного объекта, импортируемого на управляемый диск.
|
storageAccountId
|
string
|
Требуется, если createOption является импортом. Идентификатор Azure Resource Manager учетной записи хранения, содержащей большой двоичный объект для импорта в виде диска.
|
uploadSizeBytes
|
integer
|
Если createOption — Upload, это размер содержимого отправки, включая нижний колонтитул VHD. Это значение должно быть от 20972032 (20 МиБ + 512 байт для нижнего колонтитула VHD) и 35183298347520 байт (32 ТиБ + 512 байт для нижнего колонтитула VHD).
|
DataAccessAuthMode
Enumeration
Дополнительные требования к проверке подлинности при экспорте или отправке на диск или моментальный снимок.
Значение |
Описание |
AzureActiveDirectory
|
Если используется URL-адрес экспорта и отправки, система проверяет, имеет ли пользователь удостоверение в Azure Active Directory и имеет необходимые разрешения для экспорта и отправки данных. Обратитесь к aka.ms/DisksAzureADAuth.
|
None
|
При доступе к URL-адресу экспорта и отправки не будет выполнена дополнительная проверка подлинности.
|
Disk
Object
Дисковый ресурс.
Имя |
Тип |
Описание |
extendedLocation
|
ExtendedLocation
|
Расширенное расположение, в котором будет создан диск. Невозможно изменить расширенное расположение.
|
id
|
string
|
Идентификатор ресурса
|
location
|
string
|
Расположение ресурса
|
managedBy
|
string
|
Относительный URI, содержащий идентификатор виртуальной машины с подключенным диском.
|
managedByExtended
|
string[]
|
Список относительных URI, содержащих идентификаторы виртуальных машин, подключенных к диску. MaxShares должно иметь значение больше одного для дисков, чтобы разрешить присоединение их к нескольким виртуальным машинам.
|
name
|
string
|
Имя ресурса
|
properties.LastOwnershipUpdateTime
|
string
|
Время в формате UTC, когда состояние владения диска было изменено, т. е. время последнего подключения или отключения диска от виртуальной машины или времени, когда виртуальная машина, к которой был подключен диск, был освобожден или запущен.
|
properties.burstingEnabled
|
boolean
|
Задайте значение true, чтобы включить ускорение за пределами подготовленного целевого объекта производительности диска. Ускорение по умолчанию отключено. Не применяется к дискам Категории "Ультра".
|
properties.burstingEnabledTime
|
string
|
Последнее время при последней включенной вспышке на диске.
|
properties.completionPercent
|
number
|
Процент завершения фоновой копии при создании ресурса с помощью операции CopyStart.
|
properties.creationData
|
CreationData
|
Сведения об источнике диска. Данные creationData нельзя изменить после создания диска.
|
properties.dataAccessAuthMode
|
DataAccessAuthMode
|
Дополнительные требования к проверке подлинности при экспорте или отправке на диск или моментальный снимок.
|
properties.diskAccessId
|
string
|
Идентификатор ARM ресурса DiskAccess для использования частных конечных точек на дисках.
|
properties.diskIOPSReadOnly
|
integer
|
Общее количество операций ввода-вывода в секунду, которое будет разрешено во всех виртуальных машинах, которые будут подключать общий диск как ReadOnly. Одна операция может передаваться между 4k и 256 кб байтами.
|
properties.diskIOPSReadWrite
|
integer
|
Количество операций ввода-вывода в секунду, разрешенных для этого диска; только для дисков UltraSSD. Одна операция может передаваться между 4k и 256 кб байтами.
|
properties.diskMBpsReadOnly
|
integer
|
Общая пропускная способность (MBps), которая будет разрешена для всех виртуальных машин, которые будут подключать общий диск как ReadOnly. MBps означает миллионы байтов в секунду - МБ здесь использует нотацию ISO, полномочия из 10.
|
properties.diskMBpsReadWrite
|
integer
|
Пропускная способность, разрешенная для этого диска; только для дисков UltraSSD. MBps означает миллионы байтов в секунду - МБ здесь использует нотацию ISO, полномочия из 10.
|
properties.diskSizeBytes
|
integer
|
Размер диска в байтах. Это поле доступно только для чтения.
|
properties.diskSizeGB
|
integer
|
Если createData.createOption является пустым, это поле является обязательным и указывает размер создаваемого диска. Если это поле присутствует для обновлений или создания с другими параметрами, оно указывает на изменение размера. Изменение размера допускается только в том случае, если диск не подключен к работающей виртуальной машине и может увеличить размер диска.
|
properties.diskState
|
DiskState
|
Состояние диска.
|
properties.encryption
|
Encryption
|
Свойство шифрования можно использовать для шифрования неактивных данных с помощью управляемых клиентом ключей или управляемых платформой ключей.
|
properties.encryptionSettingsCollection
|
EncryptionSettingsCollection
|
Коллекция параметров шифрования, используемая для шифрования дисков Azure, может содержать несколько параметров шифрования на диск или моментальный снимок.
|
properties.hyperVGeneration
|
HyperVGeneration
|
Создание гипервизора виртуальной машины. Применимо только к дискам ОС.
|
properties.maxShares
|
integer
|
Максимальное количество виртуальных машин, которые могут подключаться к диску одновременно. Значение больше одного указывает на диск, который может быть подключен на нескольких виртуальных машинах одновременно.
|
properties.networkAccessPolicy
|
NetworkAccessPolicy
|
Политика доступа к диску через сеть.
|
properties.optimizedForFrequentAttach
|
boolean
|
При установке этого свойства значение true повышает надежность и производительность дисков данных, которые часто (более 5 раз в день) отсоединяются от одной виртуальной машины и подключены к другой. Это свойство не должно быть задано для дисков, которые не отсоединяются и подключаются часто, так как диски не соответствуют домену сбоя виртуальной машины.
|
properties.osType
|
OperatingSystemTypes
|
Тип операционной системы.
|
properties.propertyUpdatesInProgress
|
PropertyUpdatesInProgress
|
Свойства диска, для которого ожидается обновление.
|
properties.provisioningState
|
string
|
Состояние подготовки диска.
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
Политика управления экспортом на диске.
|
properties.purchasePlan
|
PurchasePlan
|
Сведения о плане покупки образа, из которого был создан диск ОС. Например: {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, продукт: WindowsServer}
|
properties.securityProfile
|
DiskSecurityProfile
|
Содержит сведения, связанные с безопасностью для ресурса.
|
properties.shareInfo
|
ShareInfoElement[]
|
Сведения о списке всех виртуальных машин, подключенных к диску. MaxShares должно иметь значение больше одного для дисков, чтобы разрешить присоединение их к нескольким виртуальным машинам.
|
properties.supportedCapabilities
|
SupportedCapabilities
|
Список поддерживаемых возможностей для образа, из которого был создан диск ОС.
|
properties.supportsHibernation
|
boolean
|
Указывает, что ОС на диске поддерживает гибернацию.
|
properties.tier
|
string
|
Уровень производительности диска (например, P4, S10), как описано здесь: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Не применяется к дискам Категории "Ультра".
|
properties.timeCreated
|
string
|
Время создания диска.
|
properties.uniqueId
|
string
|
Уникальный guid, определяющий ресурс.
|
sku
|
DiskSku
|
Имя SKU дисков. Можно Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS или PremiumV2_LRS.
|
tags
|
object
|
Теги ресурсов
|
type
|
string
|
Тип ресурса
|
zones
|
string[]
|
Список логических зон для диска.
|
DiskCreateOption
Enumeration
Это перечисляет возможные источники создания диска.
Значение |
Описание |
Attach
|
Диск будет подключен к виртуальной машине.
|
Copy
|
Создайте новый диск или моментальный снимок путем копирования с диска или моментального снимка, указанного в указанном источникеResourceId.
|
CopyFromSanSnapshot
|
Создание нового диска путем экспорта из моментального снимка эластичного сан-тома
|
CopyStart
|
Создайте новый диск с помощью процесса глубокого копирования, где создание ресурса считается завершенным только после копирования всех данных из источника.
|
Empty
|
Создайте пустой диск данных размера, заданного diskSizeGB.
|
FromImage
|
Создайте новый диск из образа платформы, указанного в указанном imageReference или galleryImageReference.
|
Import
|
Создайте диск, импортируя из большого двоичного объекта, указанного источникомUri в учетной записи хранения, указанной storageAccountId.
|
ImportSecure
|
Аналогично параметру импорта создания. Создание виртуальной машины доверенного запуска или поддерживаемой конфиденциальной виртуальной машины путем импорта дополнительных BLOB-объектов для гостевого состояния виртуальной машины, указанного в securityDataUri в учетной записи хранения, указанной в storageAccountId.
|
Restore
|
Создайте новый диск, скопировав из точки восстановления резервного копирования.
|
Upload
|
Создайте новый диск, получив маркер записи и используя его для непосредственной отправки содержимого диска.
|
UploadPreparedSecure
|
Аналогично параметру "Отправить создание". Создание виртуальной машины доверенного запуска или поддерживаемого диска конфиденциальной виртуальной машины и отправка с помощью маркера записи как в диске, так и в гостевом состоянии виртуальной машины
|
DiskSecurityProfile
Object
Содержит сведения, связанные с безопасностью для ресурса.
Имя |
Тип |
Описание |
secureVMDiskEncryptionSetId
|
string
|
ResourceId набора шифрования диска, связанного с поддерживаемым конфиденциальным диском виртуальной машины, зашифрованным с помощью управляемого клиентом ключа.
|
securityType
|
DiskSecurityTypes
|
Указывает тип безопасности виртуальной машины. Применимо только для дисков ОС.
|
DiskSecurityTypes
Enumeration
Указывает тип безопасности виртуальной машины. Применимо только для дисков ОС.
Значение |
Описание |
ConfidentialVM_DiskEncryptedWithCustomerKey
|
Указывает, что диск конфиденциальной виртуальной машины с диском ОС и гостевым состоянием виртуальной машины шифруется с помощью управляемого клиентом ключа.
|
ConfidentialVM_DiskEncryptedWithPlatformKey
|
Указывает, что диск конфиденциальной виртуальной машины с диском ОС и гостевым состоянием виртуальной машины, зашифрованным с помощью управляемого ключа платформы
|
ConfidentialVM_NonPersistedTPM
|
Указывает диск конфиденциальной виртуальной машины с временным виртуальным платформой vTPM. Состояние vTPM не сохраняется во время перезагрузки виртуальной машины.
|
ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey
|
Указывает, что диск конфиденциальной виртуальной машины с зашифрованным состоянием виртуальной машины
|
TrustedLaunch
|
Доверенный запуск предоставляет такие функции безопасности, как безопасная загрузка и виртуальный доверенный платформенный модуль (vTPM)
|
DiskSku
Object
Имя SKU дисков. Можно Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS или PremiumV2_LRS.
DiskState
Enumeration
Это перечисляет возможное состояние диска.
Значение |
Описание |
ActiveSAS
|
Диск в настоящее время связан с активным URI SAS.
|
ActiveSASFrozen
|
Диск подключен к виртуальной машине в состоянии hibernated и имеет активный URI SAS, связанный с ним.
|
ActiveUpload
|
Диск создается для отправки, а маркер записи выдан для отправки в него.
|
Attached
|
Диск в настоящее время подключен к работающей виртуальной машине.
|
Frozen
|
Диск подключен к виртуальной машине, которая находится в состоянии hibernated.
|
ReadyToUpload
|
Диск готов к созданию путем отправки путем запроса маркера записи.
|
Reserved
|
Диск подключен к остановленной виртуальной машине.
|
Unattached
|
Диск не используется и может быть подключен к виртуальной машине.
|
DiskStorageAccountTypes
Enumeration
Имя SKU.
Значение |
Описание |
PremiumV2_LRS
|
Хранилище SSD уровня "Премиум" версии 2 локально избыточное. Лучше всего подходит для рабочих нагрузок и рабочих нагрузок с учетом производительности, которые постоянно требуют низкой задержки и высокой скорости ввода-вывода в секунду и пропускной способности.
|
Premium_LRS
|
Хранилище SSD уровня "Премиум" локально избыточное. Лучше всего подходит для рабочих нагрузок и рабочих нагрузок с учетом производительности.
|
Premium_ZRS
|
Хранилище, избыточное между зонами SSD уровня "Премиум". Лучше всего подходит для рабочих нагрузок, требующих устойчивости хранилища к сбоям зоны.
|
StandardSSD_LRS
|
Локально избыточное хранилище SSD уровня "Стандартный". Лучше всего подходит для веб-серверов, легко используемых корпоративных приложений и разработки и тестирования.
|
StandardSSD_ZRS
|
Хранилище, избыточное между зонами SSD уровня "Стандартный". Лучше всего подходит для веб-серверов, легко используемых корпоративных приложений и разработки и тестирования, которые нуждаются в устойчивости хранилища к сбоям зоны.
|
Standard_LRS
|
Локально избыточное хранилище HDD уровня "Стандартный". Лучше всего подходит для резервного копирования, некритичного и редкого доступа.
|
UltraSSD_LRS
|
Локально избыточное хранилище SSD ценовой категории "Ультра". Лучше всего подходит для рабочих нагрузок с большим объемом операций ввода-вывода, таких как SAP HANA, базы данных верхнего уровня (например, SQL, Oracle) и других рабочих нагрузок с высокой нагрузкой на транзакции.
|
DiskUpdate
Object
Ресурс обновления диска.
Имя |
Тип |
Описание |
properties.burstingEnabled
|
boolean
|
Задайте значение true, чтобы включить ускорение за пределами подготовленного целевого объекта производительности диска. Ускорение по умолчанию отключено. Не применяется к дискам Категории "Ультра".
|
properties.dataAccessAuthMode
|
DataAccessAuthMode
|
Дополнительные требования к проверке подлинности при экспорте или отправке на диск или моментальный снимок.
|
properties.diskAccessId
|
string
|
Идентификатор ARM ресурса DiskAccess для использования частных конечных точек на дисках.
|
properties.diskIOPSReadOnly
|
integer
|
Общее количество операций ввода-вывода в секунду, которое будет разрешено во всех виртуальных машинах, которые будут подключать общий диск как ReadOnly. Одна операция может передаваться между 4k и 256 кб байтами.
|
properties.diskIOPSReadWrite
|
integer
|
Количество операций ввода-вывода в секунду, разрешенных для этого диска; только для дисков UltraSSD. Одна операция может передаваться между 4k и 256 кб байтами.
|
properties.diskMBpsReadOnly
|
integer
|
Общая пропускная способность (MBps), которая будет разрешена для всех виртуальных машин, которые будут подключать общий диск как ReadOnly. MBps означает миллионы байтов в секунду - МБ здесь использует нотацию ISO, полномочия из 10.
|
properties.diskMBpsReadWrite
|
integer
|
Пропускная способность, разрешенная для этого диска; только для дисков UltraSSD. MBps означает миллионы байтов в секунду - МБ здесь использует нотацию ISO, полномочия из 10.
|
properties.diskSizeGB
|
integer
|
Если createData.createOption является пустым, это поле является обязательным и указывает размер создаваемого диска. Если это поле присутствует для обновлений или создания с другими параметрами, оно указывает на изменение размера. Изменение размера допускается только в том случае, если диск не подключен к работающей виртуальной машине и может увеличить размер диска.
|
properties.encryption
|
Encryption
|
Свойство шифрования можно использовать для шифрования неактивных данных с помощью управляемых клиентом ключей или управляемых платформой ключей.
|
properties.encryptionSettingsCollection
|
EncryptionSettingsCollection
|
Коллекция параметров шифрования, используемая для шифрования дисков Azure, может содержать несколько параметров шифрования на диск или моментальный снимок.
|
properties.maxShares
|
integer
|
Максимальное количество виртуальных машин, которые могут подключаться к диску одновременно. Значение больше одного указывает на диск, который может быть подключен на нескольких виртуальных машинах одновременно.
|
properties.networkAccessPolicy
|
NetworkAccessPolicy
|
Политика доступа к диску через сеть.
|
properties.optimizedForFrequentAttach
|
boolean
|
При установке этого свойства значение true повышает надежность и производительность дисков данных, которые часто (более 5 раз в день) отсоединяются от одной виртуальной машины и подключены к другой. Это свойство не должно быть задано для дисков, которые не отсоединяются и подключаются часто, так как диски не соответствуют домену сбоя виртуальной машины.
|
properties.osType
|
OperatingSystemTypes
|
Тип операционной системы.
|
properties.propertyUpdatesInProgress
|
PropertyUpdatesInProgress
|
Свойства диска, для которого ожидается обновление.
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
Политика управления экспортом на диске.
|
properties.purchasePlan
|
PurchasePlan
|
Сведения о плане покупки, которые нужно добавить на диск ОС
|
properties.supportedCapabilities
|
SupportedCapabilities
|
Список поддерживаемых возможностей, которые необходимо добавить на диск ОС.
|
properties.supportsHibernation
|
boolean
|
Указывает, что ОС на диске поддерживает гибернацию.
|
properties.tier
|
string
|
Уровень производительности диска (например, P4, S10), как описано здесь: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Не применяется к дискам Категории "Ультра".
|
sku
|
DiskSku
|
Имя SKU дисков. Можно Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS или PremiumV2_LRS.
|
tags
|
object
|
Теги ресурсов
|
Encryption
Object
Параметры шифрования неактивных данных для диска или моментального снимка
Имя |
Тип |
Описание |
diskEncryptionSetId
|
string
|
ResourceId набора шифрования дисков, который используется для включения шифрования неактивных данных.
|
type
|
EncryptionType
|
Тип ключа, используемого для шифрования данных диска.
|
EncryptionSettingsCollection
Object
Параметры шифрования для диска или моментального снимка
Имя |
Тип |
Описание |
enabled
|
boolean
|
Задайте для этого флага значение true и укажите DiskEncryptionKey и необязательный ключ KeyEncryptionKey, чтобы включить шифрование. Установите для этого флага значение false и удалите DiskEncryptionKey и KeyEncryptionKey, чтобы отключить шифрование. Если EncryptionSettings имеет значение NULL в объекте запроса, существующие параметры остаются неизменными.
|
encryptionSettings
|
EncryptionSettingsElement[]
|
Коллекция параметров шифрования, по одному для каждого тома диска.
|
encryptionSettingsVersion
|
string
|
Описывает тип шифрования, используемый для дисков. После установки этого поля его нельзя перезаписать. "1.0" соответствует шифрованию дисков Azure с помощью приложения AAD.'1.1" соответствует шифрованию дисков Azure.
|
EncryptionSettingsElement
Object
Параметры шифрования для одного тома диска.
Имя |
Тип |
Описание |
diskEncryptionKey
|
KeyVaultAndSecretReference
|
Url-адрес секрета Key Vault и идентификатор хранилища ключа шифрования диска
|
keyEncryptionKey
|
KeyVaultAndKeyReference
|
Url-адрес ключа Key Vault и идентификатор хранилища ключа шифрования ключей. KeyEncryptionKey является необязательным и при использовании используется для распаковки ключа шифрования диска.
|
EncryptionType
Enumeration
Тип ключа, используемого для шифрования данных диска.
Значение |
Описание |
EncryptionAtRestWithCustomerKey
|
Диск шифруется неактивных данных с помощью управляемого клиентом ключа, который можно изменить и отозвать клиентом.
|
EncryptionAtRestWithPlatformAndCustomerKeys
|
Диск шифруется неактивных данных с 2 уровнями шифрования. Одним из ключей является управление клиентом, а другой — управление платформой.
|
EncryptionAtRestWithPlatformKey
|
Диск шифруется неактивных данных с помощью управляемого ключа Platform. Это тип шифрования по умолчанию. Это недопустимый тип шифрования для наборов шифрования дисков.
|
ExtendedLocation
Object
Сложный тип расширенного расположения.
Имя |
Тип |
Описание |
name
|
string
|
Имя расширенного расположения.
|
type
|
ExtendedLocationTypes
|
Тип расширенного расположения.
|
ExtendedLocationTypes
Enumeration
Тип расширенного расположения.
Значение |
Описание |
EdgeZone
|
|
HyperVGeneration
Enumeration
Создание гипервизора виртуальной машины. Применимо только к дискам ОС.
ImageDiskReference
Object
Исходный образ, используемый для создания диска.
Имя |
Тип |
Описание |
communityGalleryImageId
|
string
|
Относительный uri, содержащий ссылку на образ коллекции вычислений Azure сообщества.
|
id
|
string
|
Относительный URI, содержащий репозиторий образов платформы, образ пользователя или образ коллекции вычислений Azure.
|
lun
|
integer
|
Если диск создается на диске данных образа, это индекс, указывающий, какой из дисков данных в образе следует использовать. Для дисков ОС это поле равно NULL.
|
sharedGalleryImageId
|
string
|
Относительный URI, содержащий прямую ссылку на образ коллекции вычислений Azure.
|
KeyVaultAndKeyReference
Object
Url-адрес ключа Key Vault и идентификатор хранилища KeK, KeK является необязательным и при использовании для распаковки ключа шифрования
Имя |
Тип |
Описание |
keyUrl
|
string
|
URL-адрес, указывающий на ключ или секрет в KeyVault
|
sourceVault
|
SourceVault
|
Идентификатор ресурса KeyVault, содержащий ключ или секрет
|
KeyVaultAndSecretReference
Object
Url-адрес секрета Key Vault и идентификатор хранилища ключа шифрования
Имя |
Тип |
Описание |
secretUrl
|
string
|
URL-адрес, указывающий на ключ или секрет в KeyVault
|
sourceVault
|
SourceVault
|
Идентификатор ресурса KeyVault, содержащий ключ или секрет
|
NetworkAccessPolicy
Enumeration
Политика доступа к диску через сеть.
Значение |
Описание |
AllowAll
|
Диск можно экспортировать или отправить в любую сеть.
|
AllowPrivate
|
Диск можно экспортировать или отправить в частные конечные точки ресурса DiskAccess.
|
DenyAll
|
Диск нельзя экспортировать.
|
OperatingSystemTypes
Enumeration
Тип операционной системы.
Значение |
Описание |
Linux
|
|
Windows
|
|
PropertyUpdatesInProgress
Object
Свойства диска, для которого ожидается обновление.
Имя |
Тип |
Описание |
targetTier
|
string
|
Целевой уровень производительности диска, если выполняется операция изменения уровня.
|
ProvisionedBandwidthCopyOption
Enumeration
Если это поле установлено на моментальном снимке и createOption — CopyStart, моментальный снимок будет скопирован быстрее.
Значение |
Описание |
Enhanced
|
|
None
|
|
PublicNetworkAccess
Enumeration
Политика управления экспортом на диске.
Значение |
Описание |
Disabled
|
Вы не можете получить доступ к базовым данным диска в Интернете, даже если параметр NetworkAccessPolicy имеет значение AllowAll. Доступ к данным можно получить с помощью URI SAS только из доверенной виртуальной сети Azure, если параметр NetworkAccessPolicy имеет значение AllowPrivate.
|
Enabled
|
Вы можете создать универсальный код ресурса (URI) SAS для доступа к базовым данным диска в Интернете, если параметр NetworkAccessPolicy имеет значение AllowAll. Доступ к данным можно получить с помощью URI SAS только из доверенной виртуальной сети Azure, если параметр NetworkAccessPolicy имеет значение AllowPrivate.
|
PurchasePlan
Object
Используется для установления контекста покупки любого 3-го стороннего артефакта через MarketPlace.
Имя |
Тип |
Описание |
name
|
string
|
Идентификатор плана.
|
product
|
string
|
Задает продукт изображения из Marketplace. Это то же значение, что и Предложение в элементе imageReference.
|
promotionCode
|
string
|
Код продвижения предложения.
|
publisher
|
string
|
Идентификатор издателя.
|
ShareInfoElement
Object
Имя |
Тип |
Описание |
vmUri
|
string
|
Относительный URI, содержащий идентификатор виртуальной машины с подключенным диском.
|
SourceVault
Object
Идентификатор хранилища — это идентификатор ресурса Azure Resource Manager в форме /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
Имя |
Тип |
Описание |
id
|
string
|
Идентификатор ресурса
|
SupportedCapabilities
Object
Список поддерживаемых возможностей, сохраненных на ресурсе диска для использования виртуальной машины.
Имя |
Тип |
Описание |
acceleratedNetwork
|
boolean
|
Значение true, если образ, из которого создается диск ОС, поддерживает ускорение сети.
|
architecture
|
Architecture
|
Архитектура ЦП, поддерживаемая диском ОС.
|
diskControllerTypes
|
string
|
Контроллеры дисков, поддерживаемые диском ОС. Если задано значение SCSI или SCSI, NVME или NVME, SCSI.
|