갤러리 이미지 버전을 만들거나 업데이트합니다.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}?api-version=2024-03-03
URI 매개 변수
Name |
In(다음 안에) |
필수 |
형식 |
Description |
galleryImageName
|
path |
True
|
string
|
이미지 버전을 만들 갤러리 이미지 정의의 이름입니다.
|
galleryImageVersionName
|
path |
True
|
string
|
만들 갤러리 이미지 버전의 이름입니다. 의미 체계 버전 이름 패턴을 따라야 합니다. 허용되는 문자는 숫자와 마침표입니다. 숫자는 32비트 정수 범위 내에 있어야 합니다. 판:..
|
galleryName
|
path |
True
|
string
|
이미지 정의가 있는 공유 이미지 갤러리의 이름입니다.
|
resourceGroupName
|
path |
True
|
string
|
리소스 그룹의 이름입니다.
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure 구독을 고유하게 식별하는 구독 자격 증명입니다. 구독 ID는 모든 서비스 호출에 대한 URI의 일부를 형성합니다.
|
api-version
|
query |
True
|
string
|
클라이언트 API 버전입니다.
|
요청 본문
응답
보안
azure_auth
Azure Active Directory OAuth2 Flow
형식:
oauth2
Flow:
implicit
권한 부여 URL:
https://login.microsoftonline.com/common/oauth2/authorize
범위
Name |
Description |
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
추가 복제본 집합 정보를 설명합니다.
Name |
형식 |
Description |
regionalReplicaCount
|
integer
|
만들 이미지 버전의 직접 드라이브 복제본 수입니다. 이 속성은 업데이트할 수 있습니다.
|
storageAccountType
|
StorageAccountType
|
직접 드라이브 복제본을 만드는 데 사용할 스토리지 계정 유형을 지정합니다.
|
AggregatedReplicationState
모든 지역 복제 상태 플래그에 따라 집계된 복제 상태입니다.
Name |
형식 |
Description |
Completed
|
string
|
|
Failed
|
string
|
|
InProgress
|
string
|
|
Unknown
|
string
|
|
ApiError
API 오류입니다.
Name |
형식 |
Description |
code
|
string
|
오류 코드입니다.
|
details
|
ApiErrorBase[]
|
API 오류 세부 정보
|
innererror
|
InnerError
|
API 내부 오류
|
message
|
string
|
오류 메시지입니다.
|
target
|
string
|
특정 오류의 대상입니다.
|
ApiErrorBase
API 오류 기준입니다.
Name |
형식 |
Description |
code
|
string
|
오류 코드입니다.
|
message
|
string
|
오류 메시지입니다.
|
target
|
string
|
특정 오류의 대상입니다.
|
CloudError
Compute 서비스의 오류 응답입니다.
Name |
형식 |
Description |
error
|
ApiError
|
API 오류입니다.
|
ConfidentialVMEncryptionType
기밀 VM 암호화 유형
Name |
형식 |
Description |
EncryptedVMGuestStateOnlyWithPmk
|
string
|
|
EncryptedWithCmk
|
string
|
|
EncryptedWithPmk
|
string
|
|
NonPersistedTPM
|
string
|
|
DataDiskImageEncryption
데이터 디스크 이미지에 대한 암호화 설정을 포함합니다.
Name |
형식 |
Description |
diskEncryptionSetId
|
string
|
디스크 암호화 집합의 리소스 ID를 포함하는 상대 URI입니다.
|
lun
|
integer
|
이 속성은 데이터 디스크의 논리적 단위 번호를 지정합니다. 이 값은 Virtual Machine 내의 데이터 디스크를 식별하는 데 사용되므로 Virtual Machine에 연결된 각 데이터 디스크에 대해 고유해야 합니다.
|
EdgeZoneStorageAccountType
이미지를 저장하는 데 사용할 스토리지 계정 유형을 지정합니다. 이 속성은 업데이트할 수 없습니다.
Name |
형식 |
Description |
Premium_LRS
|
string
|
|
StandardSSD_LRS
|
string
|
|
Standard_LRS
|
string
|
|
Standard_ZRS
|
string
|
|
EncryptionImages
선택적. 사용자가 갤러리 아티팩트에서 OS 및 데이터 디스크를 암호화하기 위한 고객 관리형 키를 제공할 수 있습니다.
ExecutedValidation
실행된 유효성 검사입니다.
Name |
형식 |
Description |
executionTime
|
string
|
이 속성은 시작 타임스탬프를 지정합니다.
|
status
|
ValidationStatus
|
이 속성은 이미지 버전의 validationProfile 상태를 지정합니다.
|
type
|
string
|
이 속성은 이미지 버전 유효성 검사의 유형을 지정합니다.
|
version
|
string
|
이 속성은 유효성 검사의 유효한 버전을 지정합니다.
|
GalleryArtifactVersionFullSource
갤러리 아티팩트 버전의 원본입니다.
Name |
형식 |
Description |
communityGalleryImageId
|
string
|
원본 커뮤니티 갤러리 이미지의 리소스 ID입니다. 커뮤니티 갤러리 이미지를 원본으로 사용하는 경우에만 필요합니다.
|
id
|
string
|
갤러리 아티팩트 버전 원본의 ID입니다.
|
virtualMachineId
|
string
|
원본 가상 머신의 리소스 ID입니다. 이 갤러리 이미지 버전을 소스로 가상 머신을 캡처하는 경우에만 필요합니다.
|
GalleryDataDiskImage
데이터 디스크 이미지입니다.
Name |
형식 |
Description |
hostCaching
|
HostCaching
|
디스크의 호스트 캐싱입니다. 유효한 값은 'None', 'ReadOnly' 및 'ReadWrite'입니다.
|
lun
|
integer
|
이 속성은 데이터 디스크의 논리적 단위 번호를 지정합니다. 이 값은 Virtual Machine 내의 데이터 디스크를 식별하는 데 사용되므로 Virtual Machine에 연결된 각 데이터 디스크에 대해 고유해야 합니다.
|
sizeInGB
|
integer
|
이 속성은 만들 VHD의 크기를 나타냅니다.
|
source
|
GalleryDiskImageSource
|
디스크 이미지의 원본입니다.
|
GalleryDiskImageSource
디스크 이미지의 원본입니다.
Name |
형식 |
Description |
id
|
string
|
갤러리 아티팩트 버전 원본의 ID입니다.
|
storageAccountId
|
string
|
이 아티팩트 버전의 원본으로 사용되는 vhd Blob을 포함하는 Storage 계정 ID입니다.
|
uri
|
string
|
갤러리 아티팩트 버전 원본의 URI입니다. 현재 vhd/blob 원본을 지정하는 데 사용됩니다.
|
GalleryExtendedLocation
확장된 위치의 이름입니다.
GalleryExtendedLocationType
확장된 위치의 형식입니다.
Name |
형식 |
Description |
EdgeZone
|
string
|
|
Unknown
|
string
|
|
GalleryImageVersion
만들거나 업데이트하려는 갤러리 이미지 버전에 대한 정보를 지정합니다.
GalleryImageVersionPublishingProfile
갤러리 이미지 버전의 게시 프로필입니다.
Name |
형식 |
Description |
endOfLifeDate
|
string
|
갤러리 이미지 버전의 수명 종료 날짜입니다. 이 속성은 서비스 해제 목적으로 사용할 수 있습니다. 이 속성은 업데이트할 수 있습니다.
|
excludeFromLatest
|
boolean
|
true로 설정하면 최신 버전의 이미지 정의에서 배포된 Virtual Machines는 이 이미지 버전을 사용하지 않습니다.
|
publishedDate
|
string
|
갤러리 이미지 버전이 게시될 때의 타임스탬프입니다.
|
replicaCount
|
integer
|
지역별로 만들 이미지 버전의 복제본 수입니다. 이 속성은 regionReplicaCount가 지정되지 않은 지역에 적용됩니다. 이 속성은 업데이트할 수 있습니다.
|
replicationMode
|
ReplicationMode
|
복제에 사용할 모드를 지정하는 선택적 매개 변수입니다. 이 속성은 업데이트할 수 없습니다.
|
storageAccountType
|
StorageAccountType
|
이미지를 저장하는 데 사용할 스토리지 계정 유형을 지정합니다. 이 속성은 업데이트할 수 없습니다.
|
targetExtendedLocations
|
GalleryTargetExtendedLocation[]
|
이미지 버전이 복제될 대상 확장 위치입니다. 이 속성은 업데이트할 수 있습니다.
|
targetRegions
|
TargetRegion[]
|
이미지 버전이 복제될 대상 지역입니다. 이 속성은 업데이트할 수 있습니다.
|
GalleryImageVersionSafetyProfile
갤러리 이미지 버전의 안전 프로필입니다.
Name |
형식 |
Description |
allowDeletionOfReplicatedLocations
|
boolean
|
복제된 지역에서 이 갤러리 이미지 버전을 제거할 수 있는지 여부를 나타냅니다.
|
blockDeletionBeforeEndOfLife
|
boolean
|
수명이 종료되지 않은 경우 이 갤러리 이미지 버전에 대해 삭제가 차단되는지 여부를 나타냅니다.
|
policyViolations
|
PolicyViolation[]
|
이 갤러리 이미지 버전에 대해 보고된 정책 위반 목록입니다.
|
reportedForPolicyViolation
|
boolean
|
이 이미지가 Microsoft의 정책을 위반하는 것으로 보고되었는지 여부를 나타냅니다.
|
GalleryImageVersionStorageProfile
갤러리 이미지 버전의 스토리지 프로필입니다.
GalleryImageVersionUefiSettings
이미지 버전에 대한 UEFI 설정을 포함합니다.
GalleryOSDiskImage
OS 디스크 이미지입니다.
Name |
형식 |
Description |
hostCaching
|
HostCaching
|
디스크의 호스트 캐싱입니다. 유효한 값은 'None', 'ReadOnly' 및 'ReadWrite'입니다.
|
sizeInGB
|
integer
|
이 속성은 만들 VHD의 크기를 나타냅니다.
|
source
|
GalleryDiskImageSource
|
디스크 이미지의 원본입니다.
|
GalleryProvisioningState
갤러리 또는 갤러리 아티팩트 현재 상태입니다.
Name |
형식 |
Description |
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Migrating
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
GalleryTargetExtendedLocation
Name |
형식 |
Description |
encryption
|
EncryptionImages
|
선택적. 사용자가 갤러리 아티팩트에서 OS 및 데이터 디스크를 암호화하기 위한 고객 관리형 키를 제공할 수 있습니다.
|
extendedLocation
|
GalleryExtendedLocation
|
확장된 위치의 이름입니다.
|
extendedLocationReplicaCount
|
integer
|
확장된 위치별로 만들 이미지 버전의 복제본 수입니다. 이 속성은 업데이트할 수 있습니다.
|
name
|
string
|
지역 이름입니다.
|
storageAccountType
|
EdgeZoneStorageAccountType
|
이미지를 저장하는 데 사용할 스토리지 계정 유형을 지정합니다. 이 속성은 업데이트할 수 없습니다.
|
HostCaching
디스크의 호스트 캐싱입니다. 유효한 값은 'None', 'ReadOnly' 및 'ReadWrite'입니다.
Name |
형식 |
Description |
None
|
string
|
|
ReadOnly
|
string
|
|
ReadWrite
|
string
|
|
ImageVersionSecurityProfile
갤러리 이미지 버전의 보안 프로필
InnerError
내부 오류 세부 정보입니다.
Name |
형식 |
Description |
errordetail
|
string
|
내부 오류 메시지 또는 예외 덤프입니다.
|
exceptiontype
|
string
|
예외 형식입니다.
|
OSDiskImageEncryption
OS 디스크 이미지에 대한 암호화 설정을 포함합니다.
Name |
형식 |
Description |
diskEncryptionSetId
|
string
|
디스크 암호화 집합의 리소스 ID를 포함하는 상대 URI입니다.
|
securityProfile
|
OSDiskImageSecurityProfile
|
이 속성은 OS 디스크 이미지의 보안 프로필을 지정합니다.
|
OSDiskImageSecurityProfile
OS 디스크 이미지에 대한 보안 프로필을 포함합니다.
Name |
형식 |
Description |
confidentialVMEncryptionType
|
ConfidentialVMEncryptionType
|
기밀 VM 암호화 유형
|
secureVMDiskEncryptionSetId
|
string
|
보안 VM 디스크 암호화 집합 ID
|
이미지 버전의 플랫폼 특성입니다.
Name |
형식 |
Description |
name
|
string
|
이 속성은 platformAttribute의 이름을 지정합니다. 읽기 전용입니다.
|
value
|
string
|
이 속성은 해당 이름 속성의 값을 지정합니다. 읽기 전용입니다.
|
PolicyViolation
갤러리 아티팩트에 대해 보고된 정책 위반입니다.
Name |
형식 |
Description |
category
|
PolicyViolationCategory
|
정책 위반의 특성을 설명합니다.
|
details
|
string
|
이 정책 위반이 보고된 이유에 대한 구체적인 세부 정보를 설명합니다.
|
PolicyViolationCategory
정책 위반의 특성을 설명합니다.
Name |
형식 |
Description |
CopyrightValidation
|
string
|
|
ImageFlaggedUnsafe
|
string
|
|
IpTheft
|
string
|
|
Other
|
string
|
|
RegionalReplicationStatus
지역 복제 상태입니다.
Name |
형식 |
Description |
details
|
string
|
복제 상태의 세부 정보입니다.
|
progress
|
integer
|
복제 작업의 진행률을 나타냅니다.
|
region
|
string
|
갤러리 이미지 버전이 복제되는 지역입니다.
|
state
|
ReplicationState
|
지역 복제 상태입니다.
|
ReplicationMode
복제에 사용할 모드를 지정하는 선택적 매개 변수입니다. 이 속성은 업데이트할 수 없습니다.
Name |
형식 |
Description |
Full
|
string
|
|
Shallow
|
string
|
|
ReplicationState
지역 복제 상태입니다.
Name |
형식 |
Description |
Completed
|
string
|
|
Failed
|
string
|
|
Replicating
|
string
|
|
Unknown
|
string
|
|
ReplicationStatus
갤러리 이미지 버전의 복제 상태입니다.
StorageAccountType
이미지를 저장하는 데 사용할 스토리지 계정 유형을 지정합니다. 이 속성은 업데이트할 수 없습니다.
Name |
형식 |
Description |
PremiumV2_LRS
|
string
|
|
Premium_LRS
|
string
|
|
Standard_LRS
|
string
|
|
Standard_ZRS
|
string
|
|
TargetRegion
대상 지역 정보를 설명합니다.
Name |
형식 |
Description |
additionalReplicaSets
|
AdditionalReplicaSet[]
|
직접 드라이브 복제본을 만들기 위한 복제본 수가 있는 스토리지 sku 목록입니다.
|
encryption
|
EncryptionImages
|
선택적. 사용자가 갤러리 아티팩트에서 OS 및 데이터 디스크를 암호화하기 위한 고객 관리형 키를 제공할 수 있습니다.
|
excludeFromLatest
|
boolean
|
사용자가 version='latest'를 지정할 때 이미지를 숨기는 플래그 설정을 포함합니다.
|
name
|
string
|
지역 이름입니다.
|
regionalReplicaCount
|
integer
|
지역별로 만들 이미지 버전의 복제본 수입니다. 이 속성은 업데이트할 수 있습니다.
|
storageAccountType
|
StorageAccountType
|
이미지를 저장하는 데 사용할 스토리지 계정 유형을 지정합니다. 이 속성은 업데이트할 수 없습니다.
|
UefiKey
UEFI 키 서명입니다.
Name |
형식 |
Description |
type
|
UefiKeyType
|
키 서명의 형식입니다.
|
value
|
string[]
|
키 서명의 값입니다.
|
UefiKeySignatures
서명 템플릿 외에도 이미지에 추가될 추가 UEFI 키 서명
Name |
형식 |
Description |
db
|
UefiKey[]
|
이 이미지 버전의 UEFI 키 데이터베이스입니다.
|
dbx
|
UefiKey[]
|
이 이미지 버전에 대해 해지된 UEFI 키의 데이터베이스입니다.
|
kek
|
UefiKey[]
|
이 이미지 버전의 키 암호화 키입니다.
|
pk
|
UefiKey
|
이 이미지 버전의 플랫폼 키입니다.
|
UefiKeyType
키 서명의 형식입니다.
Name |
형식 |
Description |
sha256
|
string
|
|
x509
|
string
|
|
UefiSignatureTemplateName
기본 UEFI 키를 포함하는 서명 템플릿의 이름입니다.
Name |
형식 |
Description |
MicrosoftUefiCertificateAuthorityTemplate
|
string
|
|
MicrosoftWindowsTemplate
|
string
|
|
NoSignatureTemplate
|
string
|
|
ValidationsProfile
갤러리 이미지 버전의 유효성 검사 프로필입니다.
Name |
형식 |
Description |
executedValidations
|
ExecutedValidation[]
|
실행된 유효성 검사입니다.
|
platformAttributes
|
PlatformAttribute[]
|
그러면 이미지 버전 메타데이터의 pub, offer, sku 및 버전이 지정됩니다.
|
validationEtag
|
string
|
이미지 버전의 게시된 시간
|
ValidationStatus
이 속성은 이미지 버전의 validationProfile 상태를 지정합니다.
Name |
형식 |
Description |
Failed
|
string
|
|
Succeeded
|
string
|
|
Unknown
|
string
|
|