Создайте или обновите версию образа коллекции.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}?api-version=2024-03-03
Параметры URI
Имя |
В |
Обязательно |
Тип |
Описание |
galleryImageName
|
path |
True
|
string
|
Имя определения образа коллекции, в котором должна быть создана версия образа.
|
galleryImageVersionName
|
path |
True
|
string
|
Имя создаваемой версии образа коллекции. Необходимо следовать шаблону имени семантической версии: допустимые символы являются цифрами и периодами. Цифры должны находиться в диапазоне 32-разрядного целого числа. Формат:..
|
galleryName
|
path |
True
|
string
|
Имя общей коллекции образов, в которой находится определение образа.
|
resourceGroupName
|
path |
True
|
string
|
Имя группы ресурсов.
|
subscriptionId
|
path |
True
|
string
|
Учетные данные подписки, которые однозначно определяют подписку Microsoft Azure. Идентификатор подписки входит в состав URI для каждого вызова службы.
|
api-version
|
query |
True
|
string
|
Версия клиентского API.
|
Текст запроса
Ответы
Безопасность
azure_auth
Поток OAuth2 Azure Active Directory
Тип:
oauth2
Flow:
implicit
URL-адрес авторизации:
https://login.microsoftonline.com/common/oauth2/authorize
Области
Имя |
Описание |
user_impersonation
|
олицетворения учетной записи пользователя
|
Примеры
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
]
},
"storageProfile": {
"source": {
"communityGalleryImageId": "/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"
}
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryArtifactVersionFullSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version using community gallery image as source.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionUsingCommunityGalleryImageAsSource(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
1)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS)
.withEncryption(new EncryptionImages()
.withOsDiskImage(new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false))))
.withStorageProfile(new GalleryImageVersionStorageProfile()
.withSource(new GalleryArtifactVersionFullSource().withCommunityGalleryImageId(
"/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}")))
.withSafetyProfile(new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(false)
.withBlockDeletionBeforeEndOfLife(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingCommunityGalleryImageAsSource() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
},
{
Name: to.Ptr("East US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
Source: &armcompute.GalleryArtifactVersionFullSource{
CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"),
},
},
},
}, 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// SizeInGB: to.Ptr[int32](10),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// SizeInGB: to.Ptr[int32](10),
// },
// Source: &armcompute.GalleryArtifactVersionFullSource{
// CommunityGalleryImageID: to.Ptr("/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json
*/
async function createOrUpdateASimpleGalleryImageVersionUsingCommunityGalleryImageAsSource() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 1,
},
{
name: "East US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
storageProfile: {
source: {
communityGalleryImageId:
"/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}",
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
GallerySource = new GalleryArtifactVersionFullSource
{
CommunityGalleryImageId = "/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}",
},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"communityGalleryImageId": "/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"communityGalleryImageId": "/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"communityGalleryImageId": "/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple Gallery Image Version using managed image as source.
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
]
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
}
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryArtifactVersionFullSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version using managed image as source.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
1)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS)
.withEncryption(new EncryptionImages()
.withOsDiskImage(new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false))))
.withStorageProfile(
new GalleryImageVersionStorageProfile().withSource(new GalleryArtifactVersionFullSource().withId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}")))
.withSafetyProfile(new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(false)
.withBlockDeletionBeforeEndOfLife(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
},
{
Name: to.Ptr("East US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
Source: &armcompute.GalleryArtifactVersionFullSource{
ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
},
},
},
}, 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// SizeInGB: to.Ptr[int32](10),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// SizeInGB: to.Ptr[int32](10),
// },
// Source: &armcompute.GalleryArtifactVersionFullSource{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create.json
*/
async function createOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 1,
},
{
name: "East US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
storageProfile: {
source: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}",
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
GallerySource = new GalleryArtifactVersionFullSource
{
Id = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup//providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup//providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple Gallery Image Version using mix of disks and snapshots as a source.
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
]
},
"storageProfile": {
"osDiskImage": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryDataDiskImage;
import com.azure.resourcemanager.compute.models.GalleryDiskImageSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.GalleryOSDiskImage;
import com.azure.resourcemanager.compute.models.HostCaching;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithSnapshotsAsSource.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version using snapshots as a source.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionUsingSnapshotsAsASource(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
1)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS)
.withEncryption(new EncryptionImages()
.withOsDiskImage(new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false))))
.withStorageProfile(new GalleryImageVersionStorageProfile().withOsDiskImage(new GalleryOSDiskImage()
.withHostCaching(HostCaching.READ_ONLY)
.withSource(new GalleryDiskImageSource().withId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}")))
.withDataDiskImages(Arrays.asList(new GalleryDataDiskImage().withHostCaching(HostCaching.NONE)
.withSource(new GalleryDiskImageSource().withId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"))
.withLun(1))))
.withSafetyProfile(new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(false)
.withBlockDeletionBeforeEndOfLife(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingMixOfDisksAndSnapshotsAsASource() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
},
{
Name: to.Ptr("East US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
DataDiskImages: []*armcompute.GalleryDataDiskImage{
{
HostCaching: to.Ptr(armcompute.HostCachingNone),
Source: &armcompute.GalleryDiskImageSource{
ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"),
},
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.GalleryOSDiskImage{
HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
Source: &armcompute.GalleryDiskImageSource{
ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"),
},
},
},
},
}, 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// SizeInGB: to.Ptr[int32](10),
// Source: &armcompute.GalleryDiskImageSource{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"),
// },
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// SizeInGB: to.Ptr[int32](10),
// Source: &armcompute.GalleryDiskImageSource{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json
*/
async function createOrUpdateASimpleGalleryImageVersionUsingSnapshotsAsASource() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 1,
},
{
name: "East US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
storageProfile: {
dataDiskImages: [
{
hostCaching: "None",
lun: 1,
source: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}",
},
},
],
osDiskImage: {
hostCaching: "ReadOnly",
source: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}",
},
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
OSDiskImage = new GalleryOSDiskImage
{
HostCaching = HostCaching.ReadOnly,
GallerySource = new GalleryDiskImageSource
{
Id = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"),
},
},
DataDiskImages = {new GalleryDataDiskImage(1)
{
HostCaching = HostCaching.None,
GallerySource = new GalleryDiskImageSource
{
Id = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"),
},
}},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"
},
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"
},
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"
},
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"
},
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"
},
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"
},
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple Gallery Image Version using shallow replication mode.
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"excludeFromLatest": false
}
],
"replicationMode": "Shallow"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
}
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.GalleryArtifactVersionFullSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.ReplicationMode;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithShallowReplicationMode.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version using shallow replication mode.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions()
.createOrUpdate("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US")
.withPublishingProfile(new GalleryImageVersionPublishingProfile()
.withTargetRegions(Arrays.asList(new TargetRegion().withName("West US")
.withRegionalReplicaCount(1).withExcludeFromLatest(false)))
.withReplicationMode(ReplicationMode.SHALLOW))
.withStorageProfile(new GalleryImageVersionStorageProfile()
.withSource(new GalleryArtifactVersionFullSource().withId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}")))
.withSafetyProfile(new GalleryImageVersionSafetyProfile()
.withAllowDeletionOfReplicatedLocations(false).withBlockDeletionBeforeEndOfLife(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow),
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
Source: &armcompute.GalleryArtifactVersionFullSource{
ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
},
},
},
}, 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// ReplicationMode: to.Ptr(armcompute.ReplicationModeShallow),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// SizeInGB: to.Ptr[int32](10),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// SizeInGB: to.Ptr[int32](10),
// },
// Source: &armcompute.GalleryArtifactVersionFullSource{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json
*/
async function createOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
replicationMode: "Shallow",
targetRegions: [{ name: "West US", excludeFromLatest: false, regionalReplicaCount: 1 }],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
storageProfile: {
source: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}",
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
IsExcludedFromLatest = false,
}},
ReplicationMode = GalleryReplicationMode.Shallow,
},
StorageProfile = new GalleryImageVersionStorageProfile
{
GallerySource = new GalleryArtifactVersionFullSource
{
Id = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS",
"replicationMode": "Shallow"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS",
"replicationMode": "Shallow"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS",
"replicationMode": "Shallow"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple Gallery Image Version using shared image as source.
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
]
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"
}
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryArtifactVersionFullSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithImageVersionAsSource.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version using shared image as source.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
1)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS)
.withEncryption(new EncryptionImages()
.withOsDiskImage(new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false))))
.withStorageProfile(
new GalleryImageVersionStorageProfile().withSource(new GalleryArtifactVersionFullSource().withId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}")))
.withSafetyProfile(new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(false)
.withBlockDeletionBeforeEndOfLife(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
},
{
Name: to.Ptr("East US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
Source: &armcompute.GalleryArtifactVersionFullSource{
ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"),
},
},
},
}, 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// SizeInGB: to.Ptr[int32](10),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// SizeInGB: to.Ptr[int32](10),
// },
// Source: &armcompute.GalleryArtifactVersionFullSource{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json
*/
async function createOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 1,
},
{
name: "East US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
storageProfile: {
source: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}",
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
GallerySource = new GalleryArtifactVersionFullSource
{
Id = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"),
},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple Gallery Image Version using snapshots as a source.
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
]
},
"storageProfile": {
"osDiskImage": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryDataDiskImage;
import com.azure.resourcemanager.compute.models.GalleryDiskImageSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.GalleryOSDiskImage;
import com.azure.resourcemanager.compute.models.HostCaching;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithSnapshotsAsSource.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version using snapshots as a source.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionUsingSnapshotsAsASource(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
1)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS)
.withEncryption(new EncryptionImages()
.withOsDiskImage(new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false))))
.withStorageProfile(new GalleryImageVersionStorageProfile().withOsDiskImage(new GalleryOSDiskImage()
.withHostCaching(HostCaching.READ_ONLY)
.withSource(new GalleryDiskImageSource().withId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}")))
.withDataDiskImages(Arrays.asList(new GalleryDataDiskImage().withHostCaching(HostCaching.NONE)
.withSource(new GalleryDiskImageSource().withId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"))
.withLun(1))))
.withSafetyProfile(new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(false)
.withBlockDeletionBeforeEndOfLife(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingMixOfDisksAndSnapshotsAsASource() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
},
{
Name: to.Ptr("East US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
DataDiskImages: []*armcompute.GalleryDataDiskImage{
{
HostCaching: to.Ptr(armcompute.HostCachingNone),
Source: &armcompute.GalleryDiskImageSource{
ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"),
},
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.GalleryOSDiskImage{
HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
Source: &armcompute.GalleryDiskImageSource{
ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"),
},
},
},
},
}, 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// SizeInGB: to.Ptr[int32](10),
// Source: &armcompute.GalleryDiskImageSource{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"),
// },
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// SizeInGB: to.Ptr[int32](10),
// Source: &armcompute.GalleryDiskImageSource{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json
*/
async function createOrUpdateASimpleGalleryImageVersionUsingSnapshotsAsASource() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 1,
},
{
name: "East US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
storageProfile: {
dataDiskImages: [
{
hostCaching: "None",
lun: 1,
source: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}",
},
},
],
osDiskImage: {
hostCaching: "ReadOnly",
source: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}",
},
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
OSDiskImage = new GalleryOSDiskImage
{
HostCaching = HostCaching.ReadOnly,
GallerySource = new GalleryDiskImageSource
{
Id = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"),
},
},
DataDiskImages = {new GalleryDataDiskImage(1)
{
HostCaching = HostCaching.None,
GallerySource = new GalleryDiskImageSource
{
Id = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"),
},
}},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"
},
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"
},
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"
},
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"
},
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"
},
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}"
},
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple Gallery Image Version using vhd as a source with custom UEFI keys.
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"
},
"dataDiskImages": [
{
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet",
"lun": 1
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"excludeFromLatest": false
}
]
},
"storageProfile": {
"osDiskImage": {
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
},
"securityProfile": {
"uefiSettings": {
"signatureTemplateNames": [
"MicrosoftUefiCertificateAuthorityTemplate"
],
"additionalSignatures": {
"kek": [
{
"type": "sha256",
"value": [
"<sha256 value>"
]
}
],
"db": [
{
"type": "x509",
"value": [
"<x509 value>"
]
}
],
"dbx": [
{
"type": "x509",
"value": [
"<x509 value>"
]
}
]
}
}
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryDataDiskImage;
import com.azure.resourcemanager.compute.models.GalleryDiskImageSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionUefiSettings;
import com.azure.resourcemanager.compute.models.GalleryOSDiskImage;
import com.azure.resourcemanager.compute.models.HostCaching;
import com.azure.resourcemanager.compute.models.ImageVersionSecurityProfile;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import com.azure.resourcemanager.compute.models.UefiKey;
import com.azure.resourcemanager.compute.models.UefiKeySignatures;
import com.azure.resourcemanager.compute.models.UefiKeyType;
import com.azure.resourcemanager.compute.models.UefiSignatureTemplateName;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithVHD_UefiSettings.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version using vhd as a source with custom UEFI keys.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionUsingVhdAsASourceWithCustomUEFIKeys(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
1)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS).withExcludeFromLatest(false))))
.withStorageProfile(new GalleryImageVersionStorageProfile().withOsDiskImage(new GalleryOSDiskImage()
.withHostCaching(HostCaching.READ_ONLY)
.withSource(new GalleryDiskImageSource().withUri(
"https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd")
.withStorageAccountId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}")))
.withDataDiskImages(Arrays.asList(new GalleryDataDiskImage().withHostCaching(HostCaching.NONE)
.withSource(new GalleryDiskImageSource().withUri(
"https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd")
.withStorageAccountId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"))
.withLun(1))))
.withSafetyProfile(new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(false)
.withBlockDeletionBeforeEndOfLife(false))
.withSecurityProfile(
new ImageVersionSecurityProfile().withUefiSettings(new GalleryImageVersionUefiSettings()
.withSignatureTemplateNames(
Arrays.asList(UefiSignatureTemplateName.MICROSOFT_UEFI_CERTIFICATE_AUTHORITY_TEMPLATE))
.withAdditionalSignatures(new UefiKeySignatures()
.withKek(Arrays.asList(
new UefiKey().withType(UefiKeyType.SHA256).withValue(Arrays.asList("<sha256 value>"))))
.withDb(Arrays.asList(
new UefiKey().withType(UefiKeyType.X509).withValue(Arrays.asList("<x509 value>"))))
.withDbx(Arrays.asList(
new UefiKey().withType(UefiKeyType.X509).withValue(Arrays.asList("<x509 value>"))))))),
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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVhdAsASourceWithCustomUefiKeys() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
},
{
Name: to.Ptr("East US"),
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
SecurityProfile: &armcompute.ImageVersionSecurityProfile{
UefiSettings: &armcompute.GalleryImageVersionUefiSettings{
AdditionalSignatures: &armcompute.UefiKeySignatures{
Db: []*armcompute.UefiKey{
{
Type: to.Ptr(armcompute.UefiKeyTypeX509),
Value: []*string{
to.Ptr("<x509 value>")},
}},
Dbx: []*armcompute.UefiKey{
{
Type: to.Ptr(armcompute.UefiKeyTypeX509),
Value: []*string{
to.Ptr("<x509 value>")},
}},
Kek: []*armcompute.UefiKey{
{
Type: to.Ptr(armcompute.UefiKeyTypeSHA256),
Value: []*string{
to.Ptr("<sha256 value>")},
}},
},
SignatureTemplateNames: []*armcompute.UefiSignatureTemplateName{
to.Ptr(armcompute.UefiSignatureTemplateNameMicrosoftUefiCertificateAuthorityTemplate)},
},
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
DataDiskImages: []*armcompute.GalleryDataDiskImage{
{
HostCaching: to.Ptr(armcompute.HostCachingNone),
Source: &armcompute.GalleryDiskImageSource{
StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
},
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.GalleryOSDiskImage{
HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
Source: &armcompute.GalleryDiskImageSource{
StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
},
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// SecurityProfile: &armcompute.ImageVersionSecurityProfile{
// UefiSettings: &armcompute.GalleryImageVersionUefiSettings{
// AdditionalSignatures: &armcompute.UefiKeySignatures{
// Db: []*armcompute.UefiKey{
// {
// Type: to.Ptr(armcompute.UefiKeyTypeX509),
// Value: []*string{
// to.Ptr("<x509 value>")},
// }},
// Dbx: []*armcompute.UefiKey{
// {
// Type: to.Ptr(armcompute.UefiKeyTypeX509),
// Value: []*string{
// to.Ptr("<x509 value>")},
// }},
// Kek: []*armcompute.UefiKey{
// {
// Type: to.Ptr(armcompute.UefiKeyTypeSHA256),
// Value: []*string{
// to.Ptr("<sha256 value>")},
// }},
// },
// SignatureTemplateNames: []*armcompute.UefiSignatureTemplateName{
// to.Ptr(armcompute.UefiSignatureTemplateNameMicrosoftUefiCertificateAuthorityTemplate)},
// },
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// Source: &armcompute.GalleryDiskImageSource{
// StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
// URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
// },
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// Source: &armcompute.GalleryDiskImageSource{
// StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
// URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.json
*/
async function createOrUpdateASimpleGalleryImageVersionUsingVhdAsASourceWithCustomUefiKeys() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 1,
},
{
name: "East US",
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
securityProfile: {
uefiSettings: {
additionalSignatures: {
db: [{ type: "x509", value: ["<x509 value>"] }],
dbx: [{ type: "x509", value: ["<x509 value>"] }],
kek: [{ type: "sha256", value: ["<sha256 value>"] }],
},
signatureTemplateNames: ["MicrosoftUefiCertificateAuthorityTemplate"],
},
},
storageProfile: {
dataDiskImages: [
{
hostCaching: "None",
lun: 1,
source: {
storageAccountId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
uri: "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd",
},
},
],
osDiskImage: {
hostCaching: "ReadOnly",
source: {
storageAccountId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
uri: "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd",
},
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
OSDiskImage = new GalleryOSDiskImage
{
HostCaching = HostCaching.ReadOnly,
GallerySource = new GalleryDiskImageSource
{
Uri = new Uri("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
StorageAccountId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
},
},
DataDiskImages = {new GalleryDataDiskImage(1)
{
HostCaching = HostCaching.None,
GallerySource = new GalleryDiskImageSource
{
Uri = new Uri("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
StorageAccountId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
},
}},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
SecurityUefiSettings = new GalleryImageVersionUefiSettings
{
SignatureTemplateNames = { UefiSignatureTemplateName.MicrosoftUefiCertificateAuthorityTemplate },
AdditionalSignatures = new UefiKeySignatures
{
Kek = {new UefiKey
{
KeyType = UefiKeyType.Sha256,
Value = {"<sha256 value>"},
}},
Db = {new UefiKey
{
KeyType = UefiKeyType.X509,
Value = {"<x509 value>"},
}},
Dbx = {new UefiKey
{
KeyType = UefiKeyType.X509,
Value = {"<x509 value>"},
}},
},
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"securityProfile": {
"uefiSettings": {
"signatureTemplateNames": [
"MicrosoftUefiCertificateAuthorityTemplate"
],
"additionalSignatures": {
"kek": [
{
"type": "sha256",
"value": [
"<sha256 value>"
]
}
],
"db": [
{
"type": "x509",
"value": [
"<x509 value>"
]
}
],
"dbx": [
{
"type": "x509",
"value": [
"<x509 value>"
]
}
]
}
}
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"securityProfile": {
"uefiSettings": {
"signatureTemplateNames": [
"MicrosoftUefiCertificateAuthorityTemplate"
],
"additionalSignatures": {
"kek": [
{
"type": "sha256",
"value": [
"<sha256 value>"
]
}
],
"db": [
{
"type": "x509",
"value": [
"<x509 value>"
]
}
],
"dbx": [
{
"type": "x509",
"value": [
"<x509 value>"
]
}
]
}
}
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"securityProfile": {
"uefiSettings": {
"signatureTemplateNames": [
"MicrosoftUefiCertificateAuthorityTemplate"
],
"additionalSignatures": {
"kek": [
{
"type": "sha256",
"value": [
"<sha256 value>"
]
}
],
"db": [
{
"type": "x509",
"value": [
"<x509 value>"
]
}
],
"dbx": [
{
"type": "x509",
"value": [
"<x509 value>"
]
}
]
}
}
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple Gallery Image Version using vhd as a source.
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"
},
"dataDiskImages": [
{
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet",
"lun": 1
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"excludeFromLatest": false
}
]
},
"storageProfile": {
"osDiskImage": {
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryDataDiskImage;
import com.azure.resourcemanager.compute.models.GalleryDiskImageSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.GalleryOSDiskImage;
import com.azure.resourcemanager.compute.models.HostCaching;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithVHD.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version using vhd as a source.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
1)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS).withExcludeFromLatest(false))))
.withStorageProfile(new GalleryImageVersionStorageProfile().withOsDiskImage(new GalleryOSDiskImage()
.withHostCaching(HostCaching.READ_ONLY)
.withSource(new GalleryDiskImageSource().withUri(
"https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd")
.withStorageAccountId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}")))
.withDataDiskImages(Arrays.asList(new GalleryDataDiskImage().withHostCaching(HostCaching.NONE)
.withSource(new GalleryDiskImageSource().withUri(
"https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd")
.withStorageAccountId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"))
.withLun(1))))
.withSafetyProfile(new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(false)
.withBlockDeletionBeforeEndOfLife(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
},
{
Name: to.Ptr("East US"),
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
DataDiskImages: []*armcompute.GalleryDataDiskImage{
{
HostCaching: to.Ptr(armcompute.HostCachingNone),
Source: &armcompute.GalleryDiskImageSource{
StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
},
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.GalleryOSDiskImage{
HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
Source: &armcompute.GalleryDiskImageSource{
StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
},
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// Source: &armcompute.GalleryDiskImageSource{
// StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
// URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
// },
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// Source: &armcompute.GalleryDiskImageSource{
// StorageAccountID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
// URI: to.Ptr("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD.json
*/
async function createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 1,
},
{
name: "East US",
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
storageProfile: {
dataDiskImages: [
{
hostCaching: "None",
lun: 1,
source: {
storageAccountId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
uri: "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd",
},
},
],
osDiskImage: {
hostCaching: "ReadOnly",
source: {
storageAccountId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
uri: "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd",
},
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
OSDiskImage = new GalleryOSDiskImage
{
HostCaching = HostCaching.ReadOnly,
GallerySource = new GalleryDiskImageSource
{
Uri = new Uri("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
StorageAccountId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
},
},
DataDiskImages = {new GalleryDataDiskImage(1)
{
HostCaching = HostCaching.None,
GallerySource = new GalleryDiskImageSource
{
Uri = new Uri("https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"),
StorageAccountId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}"),
},
}},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"osDiskImage": {
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"source": {
"storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}",
"uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"
},
"lun": 1,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple Gallery Image Version using VM as source.
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 2,
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
]
},
"storageProfile": {
"source": {
"virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"
}
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryArtifactVersionFullSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithVmAsSource.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version using VM as source.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createOrUpdateASimpleGalleryImageVersionUsingVMAsSource(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
2)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS)
.withEncryption(new EncryptionImages()
.withOsDiskImage(new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false))))
.withStorageProfile(new GalleryImageVersionStorageProfile()
.withSource(new GalleryArtifactVersionFullSource().withVirtualMachineId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}")))
.withSafetyProfile(new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(false)
.withBlockDeletionBeforeEndOfLife(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionUsingVmAsSource() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("East US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
Source: &armcompute.GalleryArtifactVersionFullSource{
VirtualMachineID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
},
},
},
}, 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// SizeInGB: to.Ptr[int32](10),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// SizeInGB: to.Ptr[int32](10),
// },
// Source: &armcompute.GalleryArtifactVersionFullSource{
// VirtualMachineID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json
*/
async function createOrUpdateASimpleGalleryImageVersionUsingVMAsSource() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 2,
},
{
name: "East US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
storageProfile: {
source: {
virtualMachineId:
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}",
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 2,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
GallerySource = new GalleryArtifactVersionFullSource
{
VirtualMachineId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple Gallery Image Version with Direct Drive replicas
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"additionalReplicaSets": [
{
"storageAccountType": "PreviumV2_LRS",
"regionalReplicaCount": 1
}
],
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
]
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
}
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.AdditionalReplicaSet;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryArtifactVersionFullSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithAdditionalReplicaSets.json
*/
/**
* Sample code: Create or update a simple Gallery Image Version with Direct Drive replicas.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionWithDirectDriveReplicas(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
1)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false)
.withAdditionalReplicaSets(Arrays.asList(new AdditionalReplicaSet()
.withStorageAccountType(StorageAccountType.fromString("PreviumV2_LRS"))
.withRegionalReplicaCount(1))),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS)
.withEncryption(new EncryptionImages()
.withOsDiskImage(new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false))))
.withStorageProfile(
new GalleryImageVersionStorageProfile().withSource(new GalleryArtifactVersionFullSource().withId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}")))
.withSafetyProfile(
new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionWithDirectDriveReplicas() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
AdditionalReplicaSets: []*armcompute.AdditionalReplicaSet{
{
RegionalReplicaCount: to.Ptr[int32](1),
StorageAccountType: to.Ptr(armcompute.StorageAccountType("PreviumV2_LRS")),
}},
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
},
{
Name: to.Ptr("East US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
Source: &armcompute.GalleryArtifactVersionFullSource{
ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
},
},
},
}, 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// AdditionalReplicaSets: []*armcompute.AdditionalReplicaSet{
// {
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountType("PreviumV2_LRS")),
// }},
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// SizeInGB: to.Ptr[int32](10),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// SizeInGB: to.Ptr[int32](10),
// },
// Source: &armcompute.GalleryArtifactVersionFullSource{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.json
*/
async function createOrUpdateASimpleGalleryImageVersionWithDirectDriveReplicas() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
additionalReplicaSets: [{ regionalReplicaCount: 1, storageAccountType: "PreviumV2_LRS" }],
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 1,
},
{
name: "East US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: { allowDeletionOfReplicatedLocations: false },
storageProfile: {
source: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}",
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
AdditionalReplicaSets = {new AdditionalReplicaSet
{
StorageAccountType = new ImageStorageAccountType("PreviumV2_LRS"),
RegionalReplicaCount = 1,
}},
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
GallerySource = new GalleryArtifactVersionFullSource
{
Id = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"additionalReplicaSets": [
{
"storageAccountType": "PreviumV2_LRS",
"regionalReplicaCount": 1
}
],
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
]
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup//providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"additionalReplicaSets": [
{
"storageAccountType": "PreviumV2_LRS",
"regionalReplicaCount": 1
}
],
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
]
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup//providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"additionalReplicaSets": [
{
"storageAccountType": "PreviumV2_LRS",
"regionalReplicaCount": 1
}
],
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
]
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Create or update a simple gallery image version with target extended locations specified.
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName/versions/1.0.0?api-version=2024-03-03
{
"location": "West US",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
]
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
}
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"blockDeletionBeforeEndOfLife": false
}
}
}
import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner;
import com.azure.resourcemanager.compute.models.DataDiskImageEncryption;
import com.azure.resourcemanager.compute.models.EncryptionImages;
import com.azure.resourcemanager.compute.models.GalleryArtifactVersionFullSource;
import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionSafetyProfile;
import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile;
import com.azure.resourcemanager.compute.models.OSDiskImageEncryption;
import com.azure.resourcemanager.compute.models.StorageAccountType;
import com.azure.resourcemanager.compute.models.TargetRegion;
import java.util.Arrays;
/**
* Samples for GalleryImageVersions CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/
* GalleryImageVersion_Create_WithTargetExtendedLocations.json
*/
/**
* Sample code: Create or update a simple gallery image version with target extended locations specified.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createOrUpdateASimpleGalleryImageVersionWithTargetExtendedLocationsSpecified(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getGalleryImageVersions().createOrUpdate("myResourceGroup",
"myGalleryName", "myGalleryImageName", "1.0.0",
new GalleryImageVersionInner().withLocation("West US").withPublishingProfile(
new GalleryImageVersionPublishingProfile().withTargetRegions(Arrays.asList(new TargetRegion()
.withName("West US").withRegionalReplicaCount(
1)
.withEncryption(new EncryptionImages().withOsDiskImage(
new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false),
new TargetRegion().withName("East US").withRegionalReplicaCount(2)
.withStorageAccountType(StorageAccountType.STANDARD_ZRS)
.withEncryption(new EncryptionImages()
.withOsDiskImage(new OSDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"))
.withDataDiskImages(Arrays.asList(new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet")
.withLun(0),
new DataDiskImageEncryption().withDiskEncryptionSetId(
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")
.withLun(1))))
.withExcludeFromLatest(false))))
.withStorageProfile(
new GalleryImageVersionStorageProfile().withSource(new GalleryArtifactVersionFullSource().withId(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}")))
.withSafetyProfile(new GalleryImageVersionSafetyProfile().withAllowDeletionOfReplicatedLocations(false)
.withBlockDeletionBeforeEndOfLife(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
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/069a65e8a6d1a6c0c58d9a9d97610b7103b6e8a5/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json
func ExampleGalleryImageVersionsClient_BeginCreateOrUpdate_createOrUpdateASimpleGalleryImageVersionWithTargetExtendedLocationsSpecified() {
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.NewGalleryImageVersionsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", armcompute.GalleryImageVersion{
Location: to.Ptr("West US"),
Properties: &armcompute.GalleryImageVersionProperties{
PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
TargetRegions: []*armcompute.TargetRegion{
{
Name: to.Ptr("West US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](1),
},
{
Name: to.Ptr("East US"),
Encryption: &armcompute.EncryptionImages{
DataDiskImages: []*armcompute.DataDiskImageEncryption{
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](0),
},
{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
Lun: to.Ptr[int32](1),
}},
OSDiskImage: &armcompute.OSDiskImageEncryption{
DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
},
ExcludeFromLatest: to.Ptr(false),
RegionalReplicaCount: to.Ptr[int32](2),
StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
}},
},
SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
AllowDeletionOfReplicatedLocations: to.Ptr(false),
BlockDeletionBeforeEndOfLife: to.Ptr(false),
},
StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
Source: &armcompute.GalleryArtifactVersionFullSource{
ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
},
},
},
}, 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.GalleryImageVersion = armcompute.GalleryImageVersion{
// Name: to.Ptr("1.0.0"),
// ID: to.Ptr("/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0"),
// Location: to.Ptr("West US"),
// Properties: &armcompute.GalleryImageVersionProperties{
// ProvisioningState: to.Ptr(armcompute.GalleryProvisioningStateSucceeded),
// PublishingProfile: &armcompute.GalleryImageVersionPublishingProfile{
// PublishedDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-01T00:00:00.000Z"); return t}()),
// ReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// TargetExtendedLocations: []*armcompute.GalleryTargetExtendedLocation{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// },
// },
// ExtendedLocation: &armcompute.GalleryExtendedLocation{
// Name: to.Ptr("microsoftlosangeles1"),
// Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone),
// },
// ExtendedLocationReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.EdgeZoneStorageAccountType("StandardSSD_LRS(default)")),
// },
// {
// Name: to.Ptr("East US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// },
// },
// ExtendedLocation: &armcompute.GalleryExtendedLocation{
// Name: to.Ptr("microsoftnewyork1"),
// Type: to.Ptr(armcompute.GalleryExtendedLocationTypeEdgeZone),
// },
// ExtendedLocationReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.EdgeZoneStorageAccountType("StandardSSD_LRS(default)")),
// }},
// TargetRegions: []*armcompute.TargetRegion{
// {
// Name: to.Ptr("West US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardLRS),
// },
// {
// Name: to.Ptr("East US"),
// Encryption: &armcompute.EncryptionImages{
// DataDiskImages: []*armcompute.DataDiskImageEncryption{
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](0),
// },
// {
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.OSDiskImageEncryption{
// DiskEncryptionSetID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
// },
// },
// ExcludeFromLatest: to.Ptr(false),
// RegionalReplicaCount: to.Ptr[int32](2),
// StorageAccountType: to.Ptr(armcompute.StorageAccountTypeStandardZRS),
// }},
// },
// SafetyProfile: &armcompute.GalleryImageVersionSafetyProfile{
// AllowDeletionOfReplicatedLocations: to.Ptr(false),
// BlockDeletionBeforeEndOfLife: to.Ptr(false),
// PolicyViolations: []*armcompute.PolicyViolation{
// {
// Category: to.Ptr(armcompute.PolicyViolationCategoryImageFlaggedUnsafe),
// Details: to.Ptr("This is the policy violation details."),
// }},
// ReportedForPolicyViolation: to.Ptr(true),
// },
// StorageProfile: &armcompute.GalleryImageVersionStorageProfile{
// DataDiskImages: []*armcompute.GalleryDataDiskImage{
// {
// HostCaching: to.Ptr(armcompute.HostCachingNone),
// SizeInGB: to.Ptr[int32](10),
// Lun: to.Ptr[int32](1),
// }},
// OSDiskImage: &armcompute.GalleryOSDiskImage{
// HostCaching: to.Ptr(armcompute.HostCachingReadOnly),
// SizeInGB: to.Ptr[int32](10),
// },
// Source: &armcompute.GalleryArtifactVersionFullSource{
// ID: to.Ptr("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a gallery image version.
*
* @summary Create or update a gallery image version.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json
*/
async function createOrUpdateASimpleGalleryImageVersionWithTargetExtendedLocationsSpecified() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "myResourceGroup";
const galleryName = "myGalleryName";
const galleryImageName = "myGalleryImageName";
const galleryImageVersionName = "1.0.0";
const galleryImageVersion = {
location: "West US",
publishingProfile: {
targetRegions: [
{
name: "West US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 1,
},
{
name: "East US",
encryption: {
dataDiskImages: [
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet",
lun: 0,
},
{
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
lun: 1,
},
],
osDiskImage: {
diskEncryptionSetId:
"/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet",
},
},
excludeFromLatest: false,
regionalReplicaCount: 2,
storageAccountType: "Standard_ZRS",
},
],
},
safetyProfile: {
allowDeletionOfReplicatedLocations: false,
blockDeletionBeforeEndOfLife: false,
},
storageProfile: {
source: {
id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}",
},
},
};
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.galleryImageVersions.beginCreateOrUpdateAndWait(
resourceGroupName,
galleryName,
galleryImageName,
galleryImageVersionName,
galleryImageVersion,
);
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/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json
// this example is just showing the usage of "GalleryImageVersions_CreateOrUpdate" 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 GalleryImageResource created on azure
// for more information of creating GalleryImageResource, please refer to the document of GalleryImageResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "myResourceGroup";
string galleryName = "myGalleryName";
string galleryImageName = "myGalleryImageName";
ResourceIdentifier galleryImageResourceId = GalleryImageResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, galleryName, galleryImageName);
GalleryImageResource galleryImage = client.GetGalleryImageResource(galleryImageResourceId);
// get the collection of this GalleryImageVersionResource
GalleryImageVersionCollection collection = galleryImage.GetGalleryImageVersions();
// invoke the operation
string galleryImageVersionName = "1.0.0";
GalleryImageVersionData data = new GalleryImageVersionData(new AzureLocation("West US"))
{
PublishingProfile = new GalleryImageVersionPublishingProfile
{
TargetRegions = {new TargetRegion("West US")
{
RegionalReplicaCount = 1,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}, new TargetRegion("East US")
{
RegionalReplicaCount = 2,
StorageAccountType = ImageStorageAccountType.StandardZrs,
Encryption = new EncryptionImages
{
OSDiskImage = new OSDiskImageEncryption
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
},
DataDiskImages = {new DataDiskImageEncryption(0)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"),
}, new DataDiskImageEncryption(1)
{
DiskEncryptionSetId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"),
}},
},
IsExcludedFromLatest = false,
}},
},
StorageProfile = new GalleryImageVersionStorageProfile
{
GallerySource = new GalleryArtifactVersionFullSource
{
Id = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"),
},
},
SafetyProfile = new GalleryImageVersionSafetyProfile
{
IsBlockedDeletionBeforeEndOfLife = false,
AllowDeletionOfReplicatedLocations = false,
},
};
ArmOperation<GalleryImageVersionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, galleryImageVersionName, data);
GalleryImageVersionResource 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
GalleryImageVersionData 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
Пример ответа
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"targetExtendedLocations": [
{
"name": "West US",
"extendedLocation": {
"name": "microsoftlosangeles1",
"type": "EdgeZone"
},
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"storageAccountType": "StandardSSD_LRS(default)",
"extendedLocationReplicaCount": 1
},
{
"name": "East US",
"extendedLocation": {
"name": "microsoftnewyork1",
"type": "EdgeZone"
},
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"storageAccountType": "StandardSSD_LRS(default)",
"extendedLocationReplicaCount": 1
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Creating"
},
"location": "West US",
"name": "1.0.0"
}
{
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
"properties": {
"publishingProfile": {
"targetRegions": [
{
"name": "West US",
"regionalReplicaCount": 1,
"storageAccountType": "Standard_LRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
},
{
"name": "East US",
"regionalReplicaCount": 2,
"storageAccountType": "Standard_ZRS",
"encryption": {
"osDiskImage": {
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
},
"dataDiskImages": [
{
"lun": 0,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet"
},
{
"lun": 1,
"diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet"
}
]
},
"excludeFromLatest": false
}
],
"replicaCount": 1,
"publishedDate": "2018-01-01T00:00:00Z",
"storageAccountType": "Standard_LRS"
},
"storageProfile": {
"source": {
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"
},
"osDiskImage": {
"sizeInGB": 10,
"hostCaching": "ReadOnly"
},
"dataDiskImages": [
{
"lun": 1,
"sizeInGB": 10,
"hostCaching": "None"
}
]
},
"safetyProfile": {
"allowDeletionOfReplicatedLocations": false,
"reportedForPolicyViolation": true,
"policyViolations": [
{
"category": "ImageFlaggedUnsafe",
"details": "This is the policy violation details."
}
],
"blockDeletionBeforeEndOfLife": false
},
"provisioningState": "Updating"
},
"location": "West US",
"name": "1.0.0"
}
Определения
AdditionalReplicaSet
Описывает дополнительные сведения о наборе реплик.
Имя |
Тип |
Описание |
regionalReplicaCount
|
integer
|
Количество реплик прямого диска создаваемой версии образа. Это свойство является обновляемым
|
storageAccountType
|
StorageAccountType
|
Указывает тип учетной записи хранения, используемый для создания реплик прямого диска
|
AggregatedReplicationState
Это агрегированное состояние репликации на основе всех флагов состояния региональной репликации.
Имя |
Тип |
Описание |
Completed
|
string
|
|
Failed
|
string
|
|
InProgress
|
string
|
|
Unknown
|
string
|
|
ApiError
Ошибка API.
Имя |
Тип |
Описание |
code
|
string
|
Код ошибки.
|
details
|
ApiErrorBase[]
|
Сведения об ошибке API
|
innererror
|
InnerError
|
Внутренняя ошибка API
|
message
|
string
|
Сообщение об ошибке.
|
target
|
string
|
Целевой объект конкретной ошибки.
|
ApiErrorBase
База ошибок API.
Имя |
Тип |
Описание |
code
|
string
|
Код ошибки.
|
message
|
string
|
Сообщение об ошибке.
|
target
|
string
|
Целевой объект конкретной ошибки.
|
CloudError
Ответ на ошибку из службы вычислений.
Имя |
Тип |
Описание |
error
|
ApiError
|
Ошибка API.
|
ConfidentialVMEncryptionType
Типы шифрования конфиденциальных виртуальных машин
Имя |
Тип |
Описание |
EncryptedVMGuestStateOnlyWithPmk
|
string
|
|
EncryptedWithCmk
|
string
|
|
EncryptedWithPmk
|
string
|
|
NonPersistedTPM
|
string
|
|
DataDiskImageEncryption
Содержит параметры шифрования для образа диска данных.
Имя |
Тип |
Описание |
diskEncryptionSetId
|
string
|
Относительный URI, содержащий идентификатор ресурса набора шифрования дисков.
|
lun
|
integer
|
Это свойство указывает логическую единицу диска данных. Это значение используется для идентификации дисков данных в виртуальной машине и поэтому должно быть уникальным для каждого диска данных, подключенного к виртуальной машине.
|
EdgeZoneStorageAccountType
Указывает тип учетной записи хранения, используемый для хранения образа. Это свойство не является обновляемым.
Имя |
Тип |
Описание |
Premium_LRS
|
string
|
|
StandardSSD_LRS
|
string
|
|
Standard_LRS
|
string
|
|
Standard_ZRS
|
string
|
|
EncryptionImages
Необязательный. Позволяет пользователям предоставлять управляемые клиентом ключи для шифрования дисков ОС и данных в артефакте коллекции.
ExecutedValidation
Это выполненная проверка.
Имя |
Тип |
Описание |
executionTime
|
string
|
Это свойство задает начальную метку времени.
|
status
|
ValidationStatus
|
Это свойство указывает состояние проверкиProfile версии образа.
|
type
|
string
|
Это свойство указывает тип проверки версии образа.
|
version
|
string
|
Это свойство указывает допустимую версию проверки.
|
GalleryArtifactVersionFullSource
Источник версии артефакта коллекции.
Имя |
Тип |
Описание |
communityGalleryImageId
|
string
|
Идентификатор ресурса исходного образа коллекции сообщества. Требуется только при использовании образа коллекции сообщества в качестве источника.
|
id
|
string
|
Идентификатор источника версии артефакта коллекции.
|
virtualMachineId
|
string
|
Идентификатор ресурса исходной виртуальной машины. Требуется только при записи виртуальной машины для источника этой версии образа коллекции.
|
GalleryDataDiskImage
Это образ диска данных.
Имя |
Тип |
Описание |
hostCaching
|
HostCaching
|
Кэширование узла диска. Допустимые значения: None, ReadOnly и ReadWrite
|
lun
|
integer
|
Это свойство указывает логическую единицу диска данных. Это значение используется для идентификации дисков данных в виртуальной машине и поэтому должно быть уникальным для каждого диска данных, подключенного к виртуальной машине.
|
sizeInGB
|
integer
|
Это свойство указывает размер создаваемого виртуального жесткого диска.
|
source
|
GalleryDiskImageSource
|
Источник образа диска.
|
GalleryDiskImageSource
Источник образа диска.
Имя |
Тип |
Описание |
id
|
string
|
Идентификатор источника версии артефакта коллекции.
|
storageAccountId
|
string
|
Идентификатор учетной записи хранения, содержащий большой двоичный объект vhd, используемый в качестве источника для этой версии артефакта.
|
uri
|
string
|
URI источника версии артефакта коллекции. В настоящее время используется для указания источника vhd/BLOB-объектов.
|
GalleryExtendedLocation
Имя расширенного расположения.
GalleryExtendedLocationType
Тип расширенного расположения.
Имя |
Тип |
Описание |
EdgeZone
|
string
|
|
Unknown
|
string
|
|
GalleryImageVersion
Указывает сведения о версии образа коллекции, которую требуется создать или обновить.
Имя |
Тип |
Описание |
id
|
string
|
Идентификатор ресурса
|
location
|
string
|
Расположение ресурса
|
name
|
string
|
Имя ресурса
|
properties.provisioningState
|
GalleryProvisioningState
|
Текущее состояние артефакта коллекции или коллекции.
Состояние подготовки, которое отображается только в ответе.
|
properties.publishingProfile
|
GalleryImageVersionPublishingProfile
|
Профиль публикации версии образа коллекции.
|
properties.replicationStatus
|
ReplicationStatus
|
Это состояние репликации версии образа коллекции.
|
properties.restore
|
boolean
|
Указывает, является ли это запрос на восстановление ресурсов обратимым удалением.
|
properties.safetyProfile
|
GalleryImageVersionSafetyProfile
|
Это профиль безопасности версии образа коллекции.
|
properties.securityProfile
|
ImageVersionSecurityProfile
|
Профиль безопасности версии образа коллекции
|
properties.storageProfile
|
GalleryImageVersionStorageProfile
|
Это профиль хранения версии образа коллекции.
|
properties.validationsProfile
|
ValidationsProfile
|
Это профиль проверки версии образа коллекции.
|
tags
|
object
|
Теги ресурсов
|
type
|
string
|
Тип ресурса
|
GalleryImageVersionPublishingProfile
Профиль публикации версии образа коллекции.
Имя |
Тип |
Описание |
endOfLifeDate
|
string
|
Дата окончания срока действия версии образа коллекции. Это свойство можно использовать для вывода из эксплуатации. Это свойство является обновляемым.
|
excludeFromLatest
|
boolean
|
Если задано значение true, виртуальные машины, развернутые из последней версии определения образа, не будут использовать эту версию образа.
|
publishedDate
|
string
|
Метка времени публикации версии образа коллекции.
|
replicaCount
|
integer
|
Количество реплик версии образа для каждого региона. Это свойство вступит в силу для региона, если регионReplicaCount не указан. Это свойство является обновляемым.
|
replicationMode
|
ReplicationMode
|
Необязательный параметр, указывающий режим, используемый для репликации. Это свойство не является обновляемым.
|
storageAccountType
|
StorageAccountType
|
Указывает тип учетной записи хранения, используемый для хранения образа. Это свойство не является обновляемым.
|
targetExtendedLocations
|
GalleryTargetExtendedLocation[]
|
Целевые расширенные расположения, в которых будет реплицироваться версия образа. Это свойство является обновляемым.
|
targetRegions
|
TargetRegion[]
|
Целевые регионы, в которых будет реплицироваться версия образа. Это свойство является обновляемым.
|
GalleryImageVersionSafetyProfile
Это профиль безопасности версии образа коллекции.
Имя |
Тип |
Описание |
allowDeletionOfReplicatedLocations
|
boolean
|
Указывает, разрешено ли удаление этой версии образа коллекции из реплицированных регионов.
|
blockDeletionBeforeEndOfLife
|
boolean
|
Указывает, заблокировано ли удаление для этой версии образа коллекции, если срок ее действия не истек.
|
policyViolations
|
PolicyViolation[]
|
Список нарушений политики, о которых сообщалось для этой версии образа коллекции.
|
reportedForPolicyViolation
|
boolean
|
Указывает, было ли указано, что этот образ нарушает политики Майкрософт.
|
GalleryImageVersionStorageProfile
Это профиль хранения версии образа коллекции.
GalleryImageVersionUefiSettings
Содержит параметры UEFI для версии образа.
Имя |
Тип |
Описание |
additionalSignatures
|
UefiKeySignatures
|
Дополнительные подписи ключей UEFI, которые будут добавлены в изображение в дополнение к шаблонам подписей
|
signatureTemplateNames
|
UefiSignatureTemplateName[]
|
Имя шаблонов, содержащих подписи ключей UEFI по умолчанию, которые будут добавлены в изображение.
|
GalleryOSDiskImage
Это образ диска ОС.
Имя |
Тип |
Описание |
hostCaching
|
HostCaching
|
Кэширование узла диска. Допустимые значения: None, ReadOnly и ReadWrite
|
sizeInGB
|
integer
|
Это свойство указывает размер создаваемого виртуального жесткого диска.
|
source
|
GalleryDiskImageSource
|
Источник образа диска.
|
GalleryProvisioningState
Текущее состояние артефакта коллекции или коллекции.
Имя |
Тип |
Описание |
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Migrating
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
GalleryTargetExtendedLocation
Имя |
Тип |
Описание |
encryption
|
EncryptionImages
|
Необязательный. Позволяет пользователям предоставлять управляемые клиентом ключи для шифрования дисков ОС и данных в артефакте коллекции.
|
extendedLocation
|
GalleryExtendedLocation
|
Имя расширенного расположения.
|
extendedLocationReplicaCount
|
integer
|
Количество реплик версии образа для каждого расширенного расположения. Это свойство является обновляемым.
|
name
|
string
|
Имя региона.
|
storageAccountType
|
EdgeZoneStorageAccountType
|
Указывает тип учетной записи хранения, используемый для хранения образа. Это свойство не является обновляемым.
|
HostCaching
Кэширование узла диска. Допустимые значения: None, ReadOnly и ReadWrite
Имя |
Тип |
Описание |
None
|
string
|
|
ReadOnly
|
string
|
|
ReadWrite
|
string
|
|
ImageVersionSecurityProfile
Профиль безопасности версии образа коллекции
InnerError
Сведения о внутренней ошибке.
Имя |
Тип |
Описание |
errordetail
|
string
|
Внутреннее сообщение об ошибке или дамп исключений.
|
exceptiontype
|
string
|
Тип исключения.
|
OSDiskImageEncryption
Содержит параметры шифрования для образа диска ОС.
Имя |
Тип |
Описание |
diskEncryptionSetId
|
string
|
Относительный URI, содержащий идентификатор ресурса набора шифрования дисков.
|
securityProfile
|
OSDiskImageSecurityProfile
|
Это свойство указывает профиль безопасности образа диска ОС.
|
OSDiskImageSecurityProfile
Содержит профиль безопасности для образа диска ОС.
Имя |
Тип |
Описание |
confidentialVMEncryptionType
|
ConfidentialVMEncryptionType
|
Типы шифрования конфиденциальных виртуальных машин
|
secureVMDiskEncryptionSetId
|
string
|
Идентификатор набора шифрования дисков защищенной виртуальной машины
|
Это атрибут платформы версии образа.
Имя |
Тип |
Описание |
name
|
string
|
Это свойство указывает имя платформыAttribute. Он доступен только для чтения.
|
value
|
string
|
Это свойство указывает значение соответствующего свойства name. Он доступен только для чтения.
|
PolicyViolation
Нарушение политики, сообщаемое против артефакта коллекции.
Имя |
Тип |
Описание |
category
|
PolicyViolationCategory
|
Описывает характер нарушения политики.
|
details
|
string
|
Описание конкретных сведений о том, почему это нарушение политики было сообщено.
|
PolicyViolationCategory
Описывает характер нарушения политики.
Имя |
Тип |
Описание |
CopyrightValidation
|
string
|
|
ImageFlaggedUnsafe
|
string
|
|
IpTheft
|
string
|
|
Other
|
string
|
|
RegionalReplicationStatus
Это состояние региональной репликации.
Имя |
Тип |
Описание |
details
|
string
|
Сведения о состоянии репликации.
|
progress
|
integer
|
Он указывает ход выполнения задания репликации.
|
region
|
string
|
Регион, в который реплицируется версия образа коллекции.
|
state
|
ReplicationState
|
Это состояние региональной репликации.
|
ReplicationMode
Необязательный параметр, указывающий режим, используемый для репликации. Это свойство не является обновляемым.
Имя |
Тип |
Описание |
Full
|
string
|
|
Shallow
|
string
|
|
ReplicationState
Это состояние региональной репликации.
Имя |
Тип |
Описание |
Completed
|
string
|
|
Failed
|
string
|
|
Replicating
|
string
|
|
Unknown
|
string
|
|
ReplicationStatus
Это состояние репликации версии образа коллекции.
StorageAccountType
Указывает тип учетной записи хранения, используемый для хранения образа. Это свойство не является обновляемым.
Имя |
Тип |
Описание |
PremiumV2_LRS
|
string
|
|
Premium_LRS
|
string
|
|
Standard_LRS
|
string
|
|
Standard_ZRS
|
string
|
|
TargetRegion
Описание сведений о целевом регионе.
Имя |
Тип |
Описание |
additionalReplicaSets
|
AdditionalReplicaSet[]
|
Список SKU хранилища с числом реплик для создания реплик прямого диска.
|
encryption
|
EncryptionImages
|
Необязательный. Позволяет пользователям предоставлять управляемые клиентом ключи для шифрования дисков ОС и данных в артефакте коллекции.
|
excludeFromLatest
|
boolean
|
Содержит параметр флага, чтобы скрыть изображение, когда пользователи указывают version='latest'
|
name
|
string
|
Имя региона.
|
regionalReplicaCount
|
integer
|
Количество реплик версии образа для каждого региона. Это свойство является обновляемым.
|
storageAccountType
|
StorageAccountType
|
Указывает тип учетной записи хранения, используемый для хранения образа. Это свойство не является обновляемым.
|
UefiKey
Подпись ключа UEFI.
Имя |
Тип |
Описание |
type
|
UefiKeyType
|
Тип подписи ключа.
|
value
|
string[]
|
Значение сигнатуры ключа.
|
UefiKeySignatures
Дополнительные подписи ключей UEFI, которые будут добавлены в изображение в дополнение к шаблонам подписей
Имя |
Тип |
Описание |
db
|
UefiKey[]
|
База данных ключей UEFI для этой версии образа.
|
dbx
|
UefiKey[]
|
База данных отозванных ключей UEFI для этой версии образа.
|
kek
|
UefiKey[]
|
Ключи шифрования ключей этой версии образа.
|
pk
|
UefiKey
|
Ключ платформы этой версии образа.
|
UefiKeyType
Тип подписи ключа.
Имя |
Тип |
Описание |
sha256
|
string
|
|
x509
|
string
|
|
UefiSignatureTemplateName
Имя шаблона подписи, содержащего ключи UEFI по умолчанию.
Имя |
Тип |
Описание |
MicrosoftUefiCertificateAuthorityTemplate
|
string
|
|
MicrosoftWindowsTemplate
|
string
|
|
NoSignatureTemplate
|
string
|
|
ValidationsProfile
Это профиль проверки версии образа коллекции.
Имя |
Тип |
Описание |
executedValidations
|
ExecutedValidation[]
|
Это выполненная проверка.
|
platformAttributes
|
PlatformAttribute[]
|
Это указывает паб, предложение, номер SKU и версию метаданных версии образа.
|
validationEtag
|
string
|
Время публикации версии образа
|
ValidationStatus
Это свойство указывает состояние проверкиProfile версии образа.
Имя |
Тип |
Описание |
Failed
|
string
|
|
Succeeded
|
string
|
|
Unknown
|
string
|
|