Bulut hizmeti oluşturma veya güncelleştirme. Bazı özelliklerin yalnızca bulut hizmeti oluşturma sırasında ayarlanabileceğini lütfen unutmayın.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}?api-version=2022-09-04
URI Parametreleri
Name |
İçinde |
Gerekli |
Tür |
Description |
cloudServiceName
|
path |
True
|
string
|
Bulut hizmetinin adı.
|
resourceGroupName
|
path |
True
|
string
|
Kaynak grubunun adı.
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure aboneliğini benzersiz olarak tanımlayan abonelik kimlik bilgileri. Abonelik kimliği, her hizmet çağrısı için URI'nin bir parçasını oluşturur.
|
api-version
|
query |
True
|
string
|
İstemci Api Sürümü.
|
İstek Gövdesi
Name |
Gerekli |
Tür |
Description |
location
|
True
|
string
|
Kaynak konumu.
|
properties
|
|
CloudServiceProperties
|
Bulut hizmeti özellikleri
|
systemData
|
|
SystemData
|
Bu kaynakla ilgili sistem meta verileri.
|
tags
|
|
object
|
Kaynak etiketleri.
|
zones
|
|
string[]
|
Kaynağın mantıksal kullanılabilirlik alanı listesi. Liste, bulut hizmetinin sağlanması gereken yalnızca 1 bölge içermelidir. Bu alan isteğe bağlıdır.
|
Yanıtlar
Güvenlik
azure_auth
Azure Active Directory OAuth2 Akışı
Tür:
oauth2
Akış:
implicit
Yetkilendirme URL’si:
https://login.microsoftonline.com/common/oauth2/authorize
Kapsamlar
Name |
Description |
user_impersonation
|
kullanıcı hesabınızın kimliğine bürünme
|
Örnekler
Create New Cloud Service with Multiple Roles
Örnek isteği
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2022-09-04
{
"properties": {
"networkProfile": {
"loadBalancerConfigurations": [
{
"properties": {
"frontendIpConfigurations": [
{
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
},
"name": "contosofe"
}
]
},
"name": "contosolb"
}
]
},
"roleProfile": {
"roles": [
{
"sku": {
"name": "Standard_D1_v2",
"capacity": 1,
"tier": "Standard"
},
"name": "ContosoFrontend"
},
{
"sku": {
"name": "Standard_D1_v2",
"capacity": 1,
"tier": "Standard"
},
"name": "ContosoBackend"
}
]
},
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto"
},
"location": "westus"
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.compute.fluent.models.CloudServiceInner;
import com.azure.resourcemanager.compute.models.CloudServiceNetworkProfile;
import com.azure.resourcemanager.compute.models.CloudServiceProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfile;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfileProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleSku;
import com.azure.resourcemanager.compute.models.CloudServiceUpgradeMode;
import com.azure.resourcemanager.compute.models.LoadBalancerConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerConfigurationProperties;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfigurationProperties;
import java.util.Arrays;
/**
* Samples for CloudServices CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/
* CloudService_Create_WithMultiRole.json
*/
/**
* Sample code: Create New Cloud Service with Multiple Roles.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNewCloudServiceWithMultipleRoles(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getCloudServices()
.createOrUpdate("ConstosoRG", "{cs-name}",
new CloudServiceInner().withLocation("westus")
.withProperties(new CloudServiceProperties().withPackageUrl("{PackageUrl}")
.withConfiguration("{ServiceConfiguration}").withUpgradeMode(CloudServiceUpgradeMode.AUTO)
.withRoleProfile(new CloudServiceRoleProfile().withRoles(Arrays.asList(
new CloudServiceRoleProfileProperties().withName("ContosoFrontend")
.withSku(new CloudServiceRoleSku().withName("Standard_D1_v2").withTier("Standard")
.withCapacity(1L)),
new CloudServiceRoleProfileProperties().withName("ContosoBackend")
.withSku(new CloudServiceRoleSku().withName("Standard_D1_v2").withTier("Standard")
.withCapacity(1L)))))
.withNetworkProfile(new CloudServiceNetworkProfile().withLoadBalancerConfigurations(
Arrays.asList(new LoadBalancerConfiguration().withName("contosolb")
.withProperties(new LoadBalancerConfigurationProperties().withFrontendIpConfigurations(
Arrays.asList(new LoadBalancerFrontendIpConfiguration().withName("contosofe")
.withProperties(new LoadBalancerFrontendIpConfigurationProperties()
.withPublicIpAddress(new SubResource().withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))),
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/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole.json
func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithMultipleRoles() {
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.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
Location: to.Ptr("westus"),
Properties: &armcompute.CloudServiceProperties{
Configuration: to.Ptr("{ServiceConfiguration}"),
NetworkProfile: &armcompute.CloudServiceNetworkProfile{
LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
{
Name: to.Ptr("contosolb"),
Properties: &armcompute.LoadBalancerConfigurationProperties{
FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
{
Name: to.Ptr("contosofe"),
Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
PublicIPAddress: &armcompute.SubResource{
ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
},
},
}},
},
}},
},
PackageURL: to.Ptr("{PackageUrl}"),
RoleProfile: &armcompute.CloudServiceRoleProfile{
Roles: []*armcompute.CloudServiceRoleProfileProperties{
{
Name: to.Ptr("ContosoFrontend"),
SKU: &armcompute.CloudServiceRoleSKU{
Name: to.Ptr("Standard_D1_v2"),
Capacity: to.Ptr[int64](1),
Tier: to.Ptr("Standard"),
},
},
{
Name: to.Ptr("ContosoBackend"),
SKU: &armcompute.CloudServiceRoleSKU{
Name: to.Ptr("Standard_D1_v2"),
Capacity: to.Ptr[int64](1),
Tier: to.Ptr("Standard"),
},
}},
},
UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
},
}, 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.CloudService = armcompute.CloudService{
// Name: to.Ptr("{cs-name}"),
// Type: to.Ptr("Microsoft.Compute/cloudServices"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.CloudServiceProperties{
// Configuration: to.Ptr("{ServiceConfiguration}"),
// NetworkProfile: &armcompute.CloudServiceNetworkProfile{
// LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
// {
// Name: to.Ptr("contosolb"),
// Properties: &armcompute.LoadBalancerConfigurationProperties{
// FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
// {
// Name: to.Ptr("contosofe"),
// Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
// PublicIPAddress: &armcompute.SubResource{
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
// },
// },
// }},
// },
// }},
// },
// OSProfile: &armcompute.CloudServiceOsProfile{
// Secrets: []*armcompute.CloudServiceVaultSecretGroup{
// },
// },
// PackageURL: to.Ptr("{PackageUrl}"),
// ProvisioningState: to.Ptr("Succeeded"),
// RoleProfile: &armcompute.CloudServiceRoleProfile{
// Roles: []*armcompute.CloudServiceRoleProfileProperties{
// {
// Name: to.Ptr("ContosoFrontend"),
// SKU: &armcompute.CloudServiceRoleSKU{
// Name: to.Ptr("Standard_D1_v2"),
// Capacity: to.Ptr[int64](1),
// Tier: to.Ptr("Standard"),
// },
// },
// {
// Name: to.Ptr("ContosoBackend"),
// SKU: &armcompute.CloudServiceRoleSKU{
// Name: to.Ptr("Standard_D1_v2"),
// Capacity: to.Ptr[int64](1),
// Tier: to.Ptr("Standard"),
// },
// }},
// },
// UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"),
// UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
// },
// SystemData: &armcompute.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// },
// }
}
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 cloud service. Please note some properties can be set only during cloud service creation.
*
* @summary Create or update a cloud service. Please note some properties can be set only during cloud service creation.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole.json
*/
async function createNewCloudServiceWithMultipleRoles() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ConstosoRG";
const cloudServiceName = "{cs-name}";
const parameters = {
location: "westus",
properties: {
configuration: "{ServiceConfiguration}",
networkProfile: {
loadBalancerConfigurations: [
{
name: "contosolb",
properties: {
frontendIpConfigurations: [
{
name: "contosofe",
properties: {
publicIPAddress: {
id: "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip",
},
},
},
],
},
},
],
},
packageUrl: "{PackageUrl}",
roleProfile: {
roles: [
{
name: "ContosoFrontend",
sku: { name: "Standard_D1_v2", capacity: 1, tier: "Standard" },
},
{
name: "ContosoBackend",
sku: { name: "Standard_D1_v2", capacity: 1, tier: "Standard" },
},
],
},
upgradeMode: "Auto",
},
};
const options = { parameters };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.cloudServices.beginCreateOrUpdateAndWait(
resourceGroupName,
cloudServiceName,
options,
);
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.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole.json
// this example is just showing the usage of "CloudServices_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "ConstosoRG";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this CloudServiceResource
CloudServiceCollection collection = resourceGroupResource.GetCloudServices();
// invoke the operation
string cloudServiceName = "{cs-name}";
CloudServiceData data = new CloudServiceData(new AzureLocation("westus"))
{
PackageUri = new Uri("{PackageUrl}"),
Configuration = "{ServiceConfiguration}",
UpgradeMode = CloudServiceUpgradeMode.Auto,
Roles =
{
new CloudServiceRoleProfileProperties()
{
Name = "ContosoFrontend",
Sku = new CloudServiceRoleSku()
{
Name = "Standard_D1_v2",
Tier = "Standard",
Capacity = 1L,
},
},new CloudServiceRoleProfileProperties()
{
Name = "ContosoBackend",
Sku = new CloudServiceRoleSku()
{
Name = "Standard_D1_v2",
Tier = "Standard",
Capacity = 1L,
},
}
},
NetworkProfile = new CloudServiceNetworkProfile()
{
LoadBalancerConfigurations =
{
new CloudServiceLoadBalancerConfiguration("contosolb",new LoadBalancerFrontendIPConfiguration[]
{
new LoadBalancerFrontendIPConfiguration("contosofe")
{
PublicIPAddressId = new ResourceIdentifier("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
}
})
},
},
};
ArmOperation<CloudServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, cloudServiceName, data);
CloudServiceResource 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
CloudServiceData 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
Örnek yanıt
{
"name": "{cs-name}",
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
},
{
"name": "ContosoBackend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": []
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"name": "contosolb",
"properties": {
"frontendIpConfigurations": [
{
"name": "contosofe",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
}
}
]
}
}
]
},
"provisioningState": "Updating",
"uniqueId": "7f3edf91-cb34-4a3e-971a-177dc3dd43cb"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
}
}
location: https://foo.com/operationstatus
{
"name": "{cs-name}",
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
},
{
"name": "ContosoBackend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": []
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"name": "contosolb",
"properties": {
"frontendIpConfigurations": [
{
"name": "contosofe",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
}
}
]
}
}
]
},
"provisioningState": "Creating",
"uniqueId": "7f3edf91-cb34-4a3e-971a-177dc3dd43cb"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
}
}
Create New Cloud Service with Multiple Roles in a specific availability zone
Örnek isteği
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2022-09-04
{
"properties": {
"networkProfile": {
"loadBalancerConfigurations": [
{
"properties": {
"frontendIpConfigurations": [
{
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
},
"name": "contosofe"
}
]
},
"name": "contosolb"
}
]
},
"roleProfile": {
"roles": [
{
"sku": {
"name": "Standard_D1_v2",
"capacity": 1,
"tier": "Standard"
},
"name": "ContosoFrontend"
},
{
"sku": {
"name": "Standard_D1_v2",
"capacity": 1,
"tier": "Standard"
},
"name": "ContosoBackend"
}
]
},
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto"
},
"location": "westus",
"zones": [
"1"
]
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.compute.fluent.models.CloudServiceInner;
import com.azure.resourcemanager.compute.models.CloudServiceNetworkProfile;
import com.azure.resourcemanager.compute.models.CloudServiceProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfile;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfileProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleSku;
import com.azure.resourcemanager.compute.models.CloudServiceUpgradeMode;
import com.azure.resourcemanager.compute.models.LoadBalancerConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerConfigurationProperties;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfigurationProperties;
import java.util.Arrays;
/**
* Samples for CloudServices CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/
* CloudService_Create_WithMultiRole_WithZones.json
*/
/**
* Sample code: Create New Cloud Service with Multiple Roles in a specific availability zone.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNewCloudServiceWithMultipleRolesInASpecificAvailabilityZone(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getCloudServices()
.createOrUpdate("ConstosoRG", "{cs-name}",
new CloudServiceInner().withLocation("westus")
.withProperties(new CloudServiceProperties().withPackageUrl("{PackageUrl}")
.withConfiguration("{ServiceConfiguration}").withUpgradeMode(CloudServiceUpgradeMode.AUTO)
.withRoleProfile(new CloudServiceRoleProfile().withRoles(Arrays.asList(
new CloudServiceRoleProfileProperties().withName("ContosoFrontend")
.withSku(new CloudServiceRoleSku().withName("Standard_D1_v2").withTier("Standard")
.withCapacity(1L)),
new CloudServiceRoleProfileProperties().withName("ContosoBackend")
.withSku(new CloudServiceRoleSku().withName("Standard_D1_v2").withTier("Standard")
.withCapacity(1L)))))
.withNetworkProfile(new CloudServiceNetworkProfile().withLoadBalancerConfigurations(
Arrays.asList(new LoadBalancerConfiguration().withName("contosolb")
.withProperties(new LoadBalancerConfigurationProperties().withFrontendIpConfigurations(
Arrays.asList(new LoadBalancerFrontendIpConfiguration().withName("contosofe")
.withProperties(new LoadBalancerFrontendIpConfigurationProperties()
.withPublicIpAddress(new SubResource().withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"))))))))))
.withZones(Arrays.asList("1")),
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/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole_WithZones.json
func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithMultipleRolesInASpecificAvailabilityZone() {
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.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
Location: to.Ptr("westus"),
Properties: &armcompute.CloudServiceProperties{
Configuration: to.Ptr("{ServiceConfiguration}"),
NetworkProfile: &armcompute.CloudServiceNetworkProfile{
LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
{
Name: to.Ptr("contosolb"),
Properties: &armcompute.LoadBalancerConfigurationProperties{
FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
{
Name: to.Ptr("contosofe"),
Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
PublicIPAddress: &armcompute.SubResource{
ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
},
},
}},
},
}},
},
PackageURL: to.Ptr("{PackageUrl}"),
RoleProfile: &armcompute.CloudServiceRoleProfile{
Roles: []*armcompute.CloudServiceRoleProfileProperties{
{
Name: to.Ptr("ContosoFrontend"),
SKU: &armcompute.CloudServiceRoleSKU{
Name: to.Ptr("Standard_D1_v2"),
Capacity: to.Ptr[int64](1),
Tier: to.Ptr("Standard"),
},
},
{
Name: to.Ptr("ContosoBackend"),
SKU: &armcompute.CloudServiceRoleSKU{
Name: to.Ptr("Standard_D1_v2"),
Capacity: to.Ptr[int64](1),
Tier: to.Ptr("Standard"),
},
}},
},
UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
},
Zones: []*string{
to.Ptr("1")},
}, 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.CloudService = armcompute.CloudService{
// Name: to.Ptr("{cs-name}"),
// Type: to.Ptr("Microsoft.Compute/cloudServices"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.CloudServiceProperties{
// Configuration: to.Ptr("{ServiceConfiguration}"),
// NetworkProfile: &armcompute.CloudServiceNetworkProfile{
// LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
// {
// Name: to.Ptr("contosolb"),
// Properties: &armcompute.LoadBalancerConfigurationProperties{
// FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
// {
// Name: to.Ptr("contosofe"),
// Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
// PublicIPAddress: &armcompute.SubResource{
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
// },
// },
// }},
// },
// }},
// },
// OSProfile: &armcompute.CloudServiceOsProfile{
// Secrets: []*armcompute.CloudServiceVaultSecretGroup{
// },
// },
// PackageURL: to.Ptr("{PackageUrl}"),
// ProvisioningState: to.Ptr("Succeeded"),
// RoleProfile: &armcompute.CloudServiceRoleProfile{
// Roles: []*armcompute.CloudServiceRoleProfileProperties{
// {
// Name: to.Ptr("ContosoFrontend"),
// SKU: &armcompute.CloudServiceRoleSKU{
// Name: to.Ptr("Standard_D1_v2"),
// Capacity: to.Ptr[int64](1),
// Tier: to.Ptr("Standard"),
// },
// },
// {
// Name: to.Ptr("ContosoBackend"),
// SKU: &armcompute.CloudServiceRoleSKU{
// Name: to.Ptr("Standard_D1_v2"),
// Capacity: to.Ptr[int64](1),
// Tier: to.Ptr("Standard"),
// },
// }},
// },
// UniqueID: to.Ptr("7f3edf91-cb34-4a3e-971a-177dc3dd43cb"),
// UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
// },
// SystemData: &armcompute.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// },
// Zones: []*string{
// to.Ptr("1")},
// }
}
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 cloud service. Please note some properties can be set only during cloud service creation.
*
* @summary Create or update a cloud service. Please note some properties can be set only during cloud service creation.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole_WithZones.json
*/
async function createNewCloudServiceWithMultipleRolesInASpecificAvailabilityZone() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ConstosoRG";
const cloudServiceName = "{cs-name}";
const parameters = {
location: "westus",
properties: {
configuration: "{ServiceConfiguration}",
networkProfile: {
loadBalancerConfigurations: [
{
name: "contosolb",
properties: {
frontendIpConfigurations: [
{
name: "contosofe",
properties: {
publicIPAddress: {
id: "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip",
},
},
},
],
},
},
],
},
packageUrl: "{PackageUrl}",
roleProfile: {
roles: [
{
name: "ContosoFrontend",
sku: { name: "Standard_D1_v2", capacity: 1, tier: "Standard" },
},
{
name: "ContosoBackend",
sku: { name: "Standard_D1_v2", capacity: 1, tier: "Standard" },
},
],
},
upgradeMode: "Auto",
},
zones: ["1"],
};
const options = { parameters };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.cloudServices.beginCreateOrUpdateAndWait(
resourceGroupName,
cloudServiceName,
options,
);
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.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithMultiRole_WithZones.json
// this example is just showing the usage of "CloudServices_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "ConstosoRG";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this CloudServiceResource
CloudServiceCollection collection = resourceGroupResource.GetCloudServices();
// invoke the operation
string cloudServiceName = "{cs-name}";
CloudServiceData data = new CloudServiceData(new AzureLocation("westus"))
{
Zones =
{
"1"
},
PackageUri = new Uri("{PackageUrl}"),
Configuration = "{ServiceConfiguration}",
UpgradeMode = CloudServiceUpgradeMode.Auto,
Roles =
{
new CloudServiceRoleProfileProperties()
{
Name = "ContosoFrontend",
Sku = new CloudServiceRoleSku()
{
Name = "Standard_D1_v2",
Tier = "Standard",
Capacity = 1L,
},
},new CloudServiceRoleProfileProperties()
{
Name = "ContosoBackend",
Sku = new CloudServiceRoleSku()
{
Name = "Standard_D1_v2",
Tier = "Standard",
Capacity = 1L,
},
}
},
NetworkProfile = new CloudServiceNetworkProfile()
{
LoadBalancerConfigurations =
{
new CloudServiceLoadBalancerConfiguration("contosolb",new LoadBalancerFrontendIPConfiguration[]
{
new LoadBalancerFrontendIPConfiguration("contosofe")
{
PublicIPAddressId = new ResourceIdentifier("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
}
})
},
},
};
ArmOperation<CloudServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, cloudServiceName, data);
CloudServiceResource 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
CloudServiceData 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
Örnek yanıt
{
"name": "{cs-name}",
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
},
{
"name": "ContosoBackend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": []
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"name": "contosolb",
"properties": {
"frontendIpConfigurations": [
{
"name": "contosofe",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
}
}
]
}
}
]
},
"provisioningState": "Updating",
"uniqueId": "7f3edf91-cb34-4a3e-971a-177dc3dd43cb"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
},
"zones": [
"1"
]
}
location: https://foo.com/operationstatus
{
"name": "{cs-name}",
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
},
{
"name": "ContosoBackend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": []
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"name": "contosolb",
"properties": {
"frontendIpConfigurations": [
{
"name": "contosofe",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
}
}
]
}
}
]
},
"provisioningState": "Creating",
"uniqueId": "7f3edf91-cb34-4a3e-971a-177dc3dd43cb"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
},
"zones": [
"1"
]
}
Create New Cloud Service with Single Role
Örnek isteği
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2022-09-04
{
"location": "westus",
"properties": {
"networkProfile": {
"loadBalancerConfigurations": [
{
"properties": {
"frontendIpConfigurations": [
{
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"
}
},
"name": "myfe"
}
]
},
"name": "myLoadBalancer"
}
]
},
"roleProfile": {
"roles": [
{
"sku": {
"name": "Standard_D1_v2",
"capacity": 1,
"tier": "Standard"
},
"name": "ContosoFrontend"
}
]
},
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto"
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.compute.fluent.models.CloudServiceInner;
import com.azure.resourcemanager.compute.models.CloudServiceNetworkProfile;
import com.azure.resourcemanager.compute.models.CloudServiceProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfile;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfileProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleSku;
import com.azure.resourcemanager.compute.models.CloudServiceUpgradeMode;
import com.azure.resourcemanager.compute.models.LoadBalancerConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerConfigurationProperties;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfigurationProperties;
import java.util.Arrays;
/**
* Samples for CloudServices CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/
* CloudService_Create_WithSingleRole.json
*/
/**
* Sample code: Create New Cloud Service with Single Role.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNewCloudServiceWithSingleRole(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getCloudServices().createOrUpdate("ConstosoRG", "{cs-name}",
new CloudServiceInner().withLocation("westus").withProperties(new CloudServiceProperties()
.withPackageUrl("{PackageUrl}").withConfiguration("{ServiceConfiguration}")
.withUpgradeMode(CloudServiceUpgradeMode.AUTO)
.withRoleProfile(new CloudServiceRoleProfile().withRoles(
Arrays.asList(new CloudServiceRoleProfileProperties().withName("ContosoFrontend").withSku(
new CloudServiceRoleSku().withName("Standard_D1_v2").withTier("Standard").withCapacity(1L)))))
.withNetworkProfile(new CloudServiceNetworkProfile().withLoadBalancerConfigurations(
Arrays.asList(new LoadBalancerConfiguration().withName("myLoadBalancer")
.withProperties(new LoadBalancerConfigurationProperties().withFrontendIpConfigurations(
Arrays.asList(new LoadBalancerFrontendIpConfiguration().withName("myfe")
.withProperties(new LoadBalancerFrontendIpConfigurationProperties()
.withPublicIpAddress(new SubResource().withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP")))))))))),
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/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRole.json
func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRole() {
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.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
Location: to.Ptr("westus"),
Properties: &armcompute.CloudServiceProperties{
Configuration: to.Ptr("{ServiceConfiguration}"),
NetworkProfile: &armcompute.CloudServiceNetworkProfile{
LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
{
Name: to.Ptr("myLoadBalancer"),
Properties: &armcompute.LoadBalancerConfigurationProperties{
FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
{
Name: to.Ptr("myfe"),
Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
PublicIPAddress: &armcompute.SubResource{
ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"),
},
},
}},
},
}},
},
PackageURL: to.Ptr("{PackageUrl}"),
RoleProfile: &armcompute.CloudServiceRoleProfile{
Roles: []*armcompute.CloudServiceRoleProfileProperties{
{
Name: to.Ptr("ContosoFrontend"),
SKU: &armcompute.CloudServiceRoleSKU{
Name: to.Ptr("Standard_D1_v2"),
Capacity: to.Ptr[int64](1),
Tier: to.Ptr("Standard"),
},
}},
},
UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
},
}, 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.CloudService = armcompute.CloudService{
// Name: to.Ptr("{cs-name}"),
// Type: to.Ptr("Microsoft.Compute/cloudServices"),
// ID: to.Ptr("/subscriptions/5393f919-a68a-43d0-9063-4b2bda6bffdf/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.CloudServiceProperties{
// Configuration: to.Ptr("{ServiceConfiguration}"),
// NetworkProfile: &armcompute.CloudServiceNetworkProfile{
// LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
// {
// Name: to.Ptr("myLoadBalancer"),
// Properties: &armcompute.LoadBalancerConfigurationProperties{
// FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
// {
// Name: to.Ptr("myfe"),
// Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
// PublicIPAddress: &armcompute.SubResource{
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"),
// },
// },
// }},
// },
// }},
// },
// OSProfile: &armcompute.CloudServiceOsProfile{
// Secrets: []*armcompute.CloudServiceVaultSecretGroup{
// },
// },
// PackageURL: to.Ptr("{PackageUrl}"),
// ProvisioningState: to.Ptr("Succeeded"),
// RoleProfile: &armcompute.CloudServiceRoleProfile{
// Roles: []*armcompute.CloudServiceRoleProfileProperties{
// {
// Name: to.Ptr("ContosoFrontend"),
// SKU: &armcompute.CloudServiceRoleSKU{
// Name: to.Ptr("Standard_D1_v2"),
// Capacity: to.Ptr[int64](1),
// Tier: to.Ptr("Standard"),
// },
// }},
// },
// UniqueID: to.Ptr("14d10b45-ced7-42ef-a406-50a3df2cea7d"),
// UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
// },
// SystemData: &armcompute.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// },
// }
}
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 cloud service. Please note some properties can be set only during cloud service creation.
*
* @summary Create or update a cloud service. Please note some properties can be set only during cloud service creation.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRole.json
*/
async function createNewCloudServiceWithSingleRole() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ConstosoRG";
const cloudServiceName = "{cs-name}";
const parameters = {
location: "westus",
properties: {
configuration: "{ServiceConfiguration}",
networkProfile: {
loadBalancerConfigurations: [
{
name: "myLoadBalancer",
properties: {
frontendIpConfigurations: [
{
name: "myfe",
properties: {
publicIPAddress: {
id: "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP",
},
},
},
],
},
},
],
},
packageUrl: "{PackageUrl}",
roleProfile: {
roles: [
{
name: "ContosoFrontend",
sku: { name: "Standard_D1_v2", capacity: 1, tier: "Standard" },
},
],
},
upgradeMode: "Auto",
},
};
const options = { parameters };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.cloudServices.beginCreateOrUpdateAndWait(
resourceGroupName,
cloudServiceName,
options,
);
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.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRole.json
// this example is just showing the usage of "CloudServices_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "ConstosoRG";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this CloudServiceResource
CloudServiceCollection collection = resourceGroupResource.GetCloudServices();
// invoke the operation
string cloudServiceName = "{cs-name}";
CloudServiceData data = new CloudServiceData(new AzureLocation("westus"))
{
PackageUri = new Uri("{PackageUrl}"),
Configuration = "{ServiceConfiguration}",
UpgradeMode = CloudServiceUpgradeMode.Auto,
Roles =
{
new CloudServiceRoleProfileProperties()
{
Name = "ContosoFrontend",
Sku = new CloudServiceRoleSku()
{
Name = "Standard_D1_v2",
Tier = "Standard",
Capacity = 1L,
},
}
},
NetworkProfile = new CloudServiceNetworkProfile()
{
LoadBalancerConfigurations =
{
new CloudServiceLoadBalancerConfiguration("myLoadBalancer",new LoadBalancerFrontendIPConfiguration[]
{
new LoadBalancerFrontendIPConfiguration("myfe")
{
PublicIPAddressId = new ResourceIdentifier("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"),
}
})
},
},
};
ArmOperation<CloudServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, cloudServiceName, data);
CloudServiceResource 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
CloudServiceData 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
Örnek yanıt
{
"name": "{cs-name}",
"id": "/subscriptions/5393f919-a68a-43d0-9063-4b2bda6bffdf/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"packageUrl": "{PackageUrl}",
"configuration": "{ServiceConfiguration}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": []
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"properties": {
"frontendIpConfigurations": [
{
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"
}
},
"name": "myfe"
}
]
},
"name": "myLoadBalancer"
}
]
},
"provisioningState": "Updating",
"uniqueId": "14d10b45-ced7-42ef-a406-50a3df2cea7d"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
}
}
location: https://foo.com/operationstatus
{
"name": "{cs-name}",
"id": "/subscriptions/5393f919-a68a-43d0-9063-4b2bda6bffdf/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"packageUrl": "{PackageUrl}",
"configuration": "{ServiceConfiguration}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": []
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"properties": {
"frontendIpConfigurations": [
{
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP"
}
},
"name": "myfe"
}
]
},
"name": "myLoadBalancer"
}
]
},
"provisioningState": "Creating",
"uniqueId": "14d10b45-ced7-42ef-a406-50a3df2cea7d"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
}
}
Create New Cloud Service with Single Role and Certificate from Key Vault
Örnek isteği
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2022-09-04
{
"location": "westus",
"properties": {
"networkProfile": {
"loadBalancerConfigurations": [
{
"properties": {
"frontendIpConfigurations": [
{
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
},
"name": "contosofe"
}
]
},
"name": "contosolb"
}
]
},
"osProfile": {
"secrets": [
{
"sourceVault": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"
},
"vaultCertificates": [
{
"certificateUrl": "https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"
}
]
}
]
},
"roleProfile": {
"roles": [
{
"sku": {
"name": "Standard_D1_v2",
"capacity": 1,
"tier": "Standard"
},
"name": "ContosoFrontend"
}
]
},
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto"
}
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.compute.fluent.models.CloudServiceInner;
import com.azure.resourcemanager.compute.models.CloudServiceNetworkProfile;
import com.azure.resourcemanager.compute.models.CloudServiceOsProfile;
import com.azure.resourcemanager.compute.models.CloudServiceProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfile;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfileProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleSku;
import com.azure.resourcemanager.compute.models.CloudServiceUpgradeMode;
import com.azure.resourcemanager.compute.models.CloudServiceVaultCertificate;
import com.azure.resourcemanager.compute.models.CloudServiceVaultSecretGroup;
import com.azure.resourcemanager.compute.models.LoadBalancerConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerConfigurationProperties;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfigurationProperties;
import java.util.Arrays;
/**
* Samples for CloudServices CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/
* CloudService_Create_WithSingleRoleAndCertificate.json
*/
/**
* Sample code: Create New Cloud Service with Single Role and Certificate from Key Vault.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getCloudServices().createOrUpdate("ConstosoRG", "{cs-name}",
new CloudServiceInner().withLocation("westus").withProperties(new CloudServiceProperties()
.withPackageUrl("{PackageUrl}").withConfiguration("{ServiceConfiguration}")
.withUpgradeMode(CloudServiceUpgradeMode.AUTO)
.withRoleProfile(new CloudServiceRoleProfile().withRoles(
Arrays.asList(new CloudServiceRoleProfileProperties().withName("ContosoFrontend").withSku(
new CloudServiceRoleSku().withName("Standard_D1_v2").withTier("Standard").withCapacity(1L)))))
.withOsProfile(new CloudServiceOsProfile().withSecrets(Arrays.asList(new CloudServiceVaultSecretGroup()
.withSourceVault(new SubResource().withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"))
.withVaultCertificates(Arrays.asList(new CloudServiceVaultCertificate().withCertificateUrl(
"https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"))))))
.withNetworkProfile(new CloudServiceNetworkProfile()
.withLoadBalancerConfigurations(Arrays.asList(new LoadBalancerConfiguration().withName("contosolb")
.withProperties(new LoadBalancerConfigurationProperties().withFrontendIpConfigurations(
Arrays.asList(new LoadBalancerFrontendIpConfiguration().withName("contosofe")
.withProperties(new LoadBalancerFrontendIpConfigurationProperties()
.withPublicIpAddress(new SubResource().withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))),
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/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRoleAndCertificate.json
func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault() {
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.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
Location: to.Ptr("westus"),
Properties: &armcompute.CloudServiceProperties{
Configuration: to.Ptr("{ServiceConfiguration}"),
NetworkProfile: &armcompute.CloudServiceNetworkProfile{
LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
{
Name: to.Ptr("contosolb"),
Properties: &armcompute.LoadBalancerConfigurationProperties{
FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
{
Name: to.Ptr("contosofe"),
Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
PublicIPAddress: &armcompute.SubResource{
ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
},
},
}},
},
}},
},
OSProfile: &armcompute.CloudServiceOsProfile{
Secrets: []*armcompute.CloudServiceVaultSecretGroup{
{
SourceVault: &armcompute.SubResource{
ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"),
},
VaultCertificates: []*armcompute.CloudServiceVaultCertificate{
{
CertificateURL: to.Ptr("https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"),
}},
}},
},
PackageURL: to.Ptr("{PackageUrl}"),
RoleProfile: &armcompute.CloudServiceRoleProfile{
Roles: []*armcompute.CloudServiceRoleProfileProperties{
{
Name: to.Ptr("ContosoFrontend"),
SKU: &armcompute.CloudServiceRoleSKU{
Name: to.Ptr("Standard_D1_v2"),
Capacity: to.Ptr[int64](1),
Tier: to.Ptr("Standard"),
},
}},
},
UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
},
}, 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.CloudService = armcompute.CloudService{
// Name: to.Ptr("{cs-name}"),
// Type: to.Ptr("Microsoft.Compute/cloudServices"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.CloudServiceProperties{
// Configuration: to.Ptr("{ServiceConfiguration}"),
// NetworkProfile: &armcompute.CloudServiceNetworkProfile{
// LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
// {
// Name: to.Ptr("contosolb"),
// Properties: &armcompute.LoadBalancerConfigurationProperties{
// FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
// {
// Name: to.Ptr("contosofe"),
// Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
// PublicIPAddress: &armcompute.SubResource{
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
// },
// },
// }},
// },
// }},
// },
// OSProfile: &armcompute.CloudServiceOsProfile{
// Secrets: []*armcompute.CloudServiceVaultSecretGroup{
// {
// SourceVault: &armcompute.SubResource{
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"),
// },
// VaultCertificates: []*armcompute.CloudServiceVaultCertificate{
// {
// CertificateURL: to.Ptr("https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"),
// }},
// }},
// },
// PackageURL: to.Ptr("{PackageUrl}"),
// ProvisioningState: to.Ptr("Succeeded"),
// RoleProfile: &armcompute.CloudServiceRoleProfile{
// Roles: []*armcompute.CloudServiceRoleProfileProperties{
// {
// Name: to.Ptr("ContosoFrontend"),
// SKU: &armcompute.CloudServiceRoleSKU{
// Name: to.Ptr("Standard_D1_v2"),
// Capacity: to.Ptr[int64](1),
// Tier: to.Ptr("Standard"),
// },
// }},
// },
// UniqueID: to.Ptr("60b6cd59-600b-4e02-b717-521b07aa94bf"),
// UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
// },
// SystemData: &armcompute.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// },
// }
}
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 cloud service. Please note some properties can be set only during cloud service creation.
*
* @summary Create or update a cloud service. Please note some properties can be set only during cloud service creation.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRoleAndCertificate.json
*/
async function createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ConstosoRG";
const cloudServiceName = "{cs-name}";
const parameters = {
location: "westus",
properties: {
configuration: "{ServiceConfiguration}",
networkProfile: {
loadBalancerConfigurations: [
{
name: "contosolb",
properties: {
frontendIpConfigurations: [
{
name: "contosofe",
properties: {
publicIPAddress: {
id: "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip",
},
},
},
],
},
},
],
},
osProfile: {
secrets: [
{
sourceVault: {
id: "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}",
},
vaultCertificates: [
{
certificateUrl:
"https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}",
},
],
},
],
},
packageUrl: "{PackageUrl}",
roleProfile: {
roles: [
{
name: "ContosoFrontend",
sku: { name: "Standard_D1_v2", capacity: 1, tier: "Standard" },
},
],
},
upgradeMode: "Auto",
},
};
const options = { parameters };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.cloudServices.beginCreateOrUpdateAndWait(
resourceGroupName,
cloudServiceName,
options,
);
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.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRoleAndCertificate.json
// this example is just showing the usage of "CloudServices_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "ConstosoRG";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this CloudServiceResource
CloudServiceCollection collection = resourceGroupResource.GetCloudServices();
// invoke the operation
string cloudServiceName = "{cs-name}";
CloudServiceData data = new CloudServiceData(new AzureLocation("westus"))
{
PackageUri = new Uri("{PackageUrl}"),
Configuration = "{ServiceConfiguration}",
UpgradeMode = CloudServiceUpgradeMode.Auto,
Roles =
{
new CloudServiceRoleProfileProperties()
{
Name = "ContosoFrontend",
Sku = new CloudServiceRoleSku()
{
Name = "Standard_D1_v2",
Tier = "Standard",
Capacity = 1L,
},
}
},
OSSecrets =
{
new CloudServiceVaultSecretGroup()
{
SourceVaultId = new ResourceIdentifier("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"),
VaultCertificates =
{
new CloudServiceVaultCertificate()
{
CertificateUri = new Uri("https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"),
}
},
}
},
NetworkProfile = new CloudServiceNetworkProfile()
{
LoadBalancerConfigurations =
{
new CloudServiceLoadBalancerConfiguration("contosolb",new LoadBalancerFrontendIPConfiguration[]
{
new LoadBalancerFrontendIPConfiguration("contosofe")
{
PublicIPAddressId = new ResourceIdentifier("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
}
})
},
},
};
ArmOperation<CloudServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, cloudServiceName, data);
CloudServiceResource 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
CloudServiceData 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
Örnek yanıt
{
"name": "{cs-name}",
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": [
{
"sourceVault": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"
},
"vaultCertificates": [
{
"certificateUrl": "https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"
}
]
}
]
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"name": "contosolb",
"properties": {
"frontendIpConfigurations": [
{
"name": "contosofe",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
}
}
]
}
}
]
},
"provisioningState": "Updating",
"uniqueId": "60b6cd59-600b-4e02-b717-521b07aa94bf"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
}
}
location: https://foo.com/operationstatus
{
"name": "{cs-name}",
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": [
{
"sourceVault": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}"
},
"vaultCertificates": [
{
"certificateUrl": "https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}"
}
]
}
]
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"name": "contosolb",
"properties": {
"frontendIpConfigurations": [
{
"name": "contosofe",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
}
}
]
}
}
]
},
"provisioningState": "Creating",
"uniqueId": "60b6cd59-600b-4e02-b717-521b07aa94bf"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
}
}
Create New Cloud Service with Single Role and RDP Extension
Örnek isteği
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2022-09-04
{
"properties": {
"extensionProfile": {
"extensions": [
{
"properties": {
"type": "RDP",
"autoUpgradeMinorVersion": false,
"protectedSettings": "<PrivateConfig><Password>{password}</Password></PrivateConfig>",
"publisher": "Microsoft.Windows.Azure.Extensions",
"settings": "<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>",
"typeHandlerVersion": "1.2"
},
"name": "RDPExtension"
}
]
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"properties": {
"frontendIpConfigurations": [
{
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
},
"name": "contosofe"
}
]
},
"name": "contosolb"
}
]
},
"roleProfile": {
"roles": [
{
"sku": {
"name": "Standard_D1_v2",
"capacity": 1,
"tier": "Standard"
},
"name": "ContosoFrontend"
}
]
},
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto"
},
"location": "westus"
}
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.compute.fluent.models.CloudServiceInner;
import com.azure.resourcemanager.compute.models.CloudServiceExtensionProfile;
import com.azure.resourcemanager.compute.models.CloudServiceExtensionProperties;
import com.azure.resourcemanager.compute.models.CloudServiceNetworkProfile;
import com.azure.resourcemanager.compute.models.CloudServiceProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfile;
import com.azure.resourcemanager.compute.models.CloudServiceRoleProfileProperties;
import com.azure.resourcemanager.compute.models.CloudServiceRoleSku;
import com.azure.resourcemanager.compute.models.CloudServiceUpgradeMode;
import com.azure.resourcemanager.compute.models.Extension;
import com.azure.resourcemanager.compute.models.LoadBalancerConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerConfigurationProperties;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfiguration;
import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfigurationProperties;
import java.util.Arrays;
/**
* Samples for CloudServices CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/
* CloudService_Create_WithSingleRoleAndRDP.json
*/
/**
* Sample code: Create New Cloud Service with Single Role and RDP Extension.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
createNewCloudServiceWithSingleRoleAndRDPExtension(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getCloudServices().createOrUpdate("ConstosoRG", "{cs-name}",
new CloudServiceInner().withLocation("westus").withProperties(new CloudServiceProperties()
.withPackageUrl("{PackageUrl}").withConfiguration("{ServiceConfiguration}")
.withUpgradeMode(CloudServiceUpgradeMode.AUTO)
.withRoleProfile(new CloudServiceRoleProfile().withRoles(
Arrays.asList(new CloudServiceRoleProfileProperties().withName("ContosoFrontend").withSku(
new CloudServiceRoleSku().withName("Standard_D1_v2").withTier("Standard").withCapacity(1L)))))
.withNetworkProfile(new CloudServiceNetworkProfile()
.withLoadBalancerConfigurations(Arrays.asList(new LoadBalancerConfiguration().withName("contosolb")
.withProperties(new LoadBalancerConfigurationProperties().withFrontendIpConfigurations(
Arrays.asList(new LoadBalancerFrontendIpConfiguration().withName("contosofe")
.withProperties(new LoadBalancerFrontendIpConfigurationProperties()
.withPublicIpAddress(new SubResource().withId(
"/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))
.withExtensionProfile(new CloudServiceExtensionProfile().withExtensions(Arrays.asList(new Extension()
.withName("RDPExtension")
.withProperties(new CloudServiceExtensionProperties()
.withPublisher("Microsoft.Windows.Azure.Extensions").withType("RDP")
.withTypeHandlerVersion("1.2").withAutoUpgradeMinorVersion(false)
.withSettings(
"<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>")
.withProtectedSettings("<PrivateConfig><Password>{password}</Password></PrivateConfig>")))))),
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/c7b98b36e4023331545051284d8500adf98f02fe/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRoleAndRDP.json
func ExampleCloudServicesClient_BeginCreateOrUpdate_createNewCloudServiceWithSingleRoleAndRdpExtension() {
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.NewCloudServicesClient().BeginCreateOrUpdate(ctx, "ConstosoRG", "{cs-name}", armcompute.CloudService{
Location: to.Ptr("westus"),
Properties: &armcompute.CloudServiceProperties{
Configuration: to.Ptr("{ServiceConfiguration}"),
ExtensionProfile: &armcompute.CloudServiceExtensionProfile{
Extensions: []*armcompute.Extension{
{
Name: to.Ptr("RDPExtension"),
Properties: &armcompute.CloudServiceExtensionProperties{
Type: to.Ptr("RDP"),
AutoUpgradeMinorVersion: to.Ptr(false),
ProtectedSettings: "<PrivateConfig><Password>{password}</Password></PrivateConfig>",
Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"),
Settings: "<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>",
TypeHandlerVersion: to.Ptr("1.2"),
},
}},
},
NetworkProfile: &armcompute.CloudServiceNetworkProfile{
LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
{
Name: to.Ptr("contosolb"),
Properties: &armcompute.LoadBalancerConfigurationProperties{
FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
{
Name: to.Ptr("contosofe"),
Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
PublicIPAddress: &armcompute.SubResource{
ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
},
},
}},
},
}},
},
PackageURL: to.Ptr("{PackageUrl}"),
RoleProfile: &armcompute.CloudServiceRoleProfile{
Roles: []*armcompute.CloudServiceRoleProfileProperties{
{
Name: to.Ptr("ContosoFrontend"),
SKU: &armcompute.CloudServiceRoleSKU{
Name: to.Ptr("Standard_D1_v2"),
Capacity: to.Ptr[int64](1),
Tier: to.Ptr("Standard"),
},
}},
},
UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
},
}, 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.CloudService = armcompute.CloudService{
// Name: to.Ptr("{cs-name}"),
// Type: to.Ptr("Microsoft.Compute/cloudServices"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}"),
// Location: to.Ptr("westus"),
// Properties: &armcompute.CloudServiceProperties{
// Configuration: to.Ptr("{ServiceConfiguration}"),
// ExtensionProfile: &armcompute.CloudServiceExtensionProfile{
// Extensions: []*armcompute.Extension{
// {
// Name: to.Ptr("RDPExtension"),
// Properties: &armcompute.CloudServiceExtensionProperties{
// Type: to.Ptr("RDP"),
// AutoUpgradeMinorVersion: to.Ptr(false),
// ProvisioningState: to.Ptr("Succeeded"),
// Publisher: to.Ptr("Microsoft.Windows.Azure.Extensions"),
// RolesAppliedTo: []*string{
// to.Ptr("*")},
// Settings: "<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>",
// TypeHandlerVersion: to.Ptr("1.2"),
// },
// }},
// },
// NetworkProfile: &armcompute.CloudServiceNetworkProfile{
// LoadBalancerConfigurations: []*armcompute.LoadBalancerConfiguration{
// {
// Name: to.Ptr("contosolb"),
// Properties: &armcompute.LoadBalancerConfigurationProperties{
// FrontendIPConfigurations: []*armcompute.LoadBalancerFrontendIPConfiguration{
// {
// Name: to.Ptr("contosofe"),
// Properties: &armcompute.LoadBalancerFrontendIPConfigurationProperties{
// PublicIPAddress: &armcompute.SubResource{
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
// },
// },
// }},
// },
// }},
// },
// OSProfile: &armcompute.CloudServiceOsProfile{
// Secrets: []*armcompute.CloudServiceVaultSecretGroup{
// },
// },
// PackageURL: to.Ptr("{PackageUrl}"),
// ProvisioningState: to.Ptr("Succeeded"),
// RoleProfile: &armcompute.CloudServiceRoleProfile{
// Roles: []*armcompute.CloudServiceRoleProfileProperties{
// {
// Name: to.Ptr("ContosoFrontend"),
// SKU: &armcompute.CloudServiceRoleSKU{
// Name: to.Ptr("Standard_D1_v2"),
// Capacity: to.Ptr[int64](1),
// Tier: to.Ptr("Standard"),
// },
// }},
// },
// UniqueID: to.Ptr("c948cccb-bbfa-4516-a250-c28abc4d0c15"),
// UpgradeMode: to.Ptr(armcompute.CloudServiceUpgradeModeAuto),
// },
// SystemData: &armcompute.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.123Z"); return t}()),
// },
// }
}
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 cloud service. Please note some properties can be set only during cloud service creation.
*
* @summary Create or update a cloud service. Please note some properties can be set only during cloud service creation.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRoleAndRDP.json
*/
async function createNewCloudServiceWithSingleRoleAndRdpExtension() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["COMPUTE_RESOURCE_GROUP"] || "ConstosoRG";
const cloudServiceName = "{cs-name}";
const parameters = {
location: "westus",
properties: {
configuration: "{ServiceConfiguration}",
extensionProfile: {
extensions: [
{
name: "RDPExtension",
properties: {
type: "RDP",
autoUpgradeMinorVersion: false,
protectedSettings: "<PrivateConfig><Password>{password}</Password></PrivateConfig>",
publisher: "Microsoft.Windows.Azure.Extensions",
settings:
"<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>",
typeHandlerVersion: "1.2",
},
},
],
},
networkProfile: {
loadBalancerConfigurations: [
{
name: "contosolb",
properties: {
frontendIpConfigurations: [
{
name: "contosofe",
properties: {
publicIPAddress: {
id: "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip",
},
},
},
],
},
},
],
},
packageUrl: "{PackageUrl}",
roleProfile: {
roles: [
{
name: "ContosoFrontend",
sku: { name: "Standard_D1_v2", capacity: 1, tier: "Standard" },
},
],
},
upgradeMode: "Auto",
},
};
const options = { parameters };
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const result = await client.cloudServices.beginCreateOrUpdateAndWait(
resourceGroupName,
cloudServiceName,
options,
);
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.Resources;
using Azure.ResourceManager.Compute;
// Generated from example definition: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2022-09-04/examples/CloudService_Create_WithSingleRoleAndRDP.json
// this example is just showing the usage of "CloudServices_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "ConstosoRG";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this CloudServiceResource
CloudServiceCollection collection = resourceGroupResource.GetCloudServices();
// invoke the operation
string cloudServiceName = "{cs-name}";
CloudServiceData data = new CloudServiceData(new AzureLocation("westus"))
{
PackageUri = new Uri("{PackageUrl}"),
Configuration = "{ServiceConfiguration}",
UpgradeMode = CloudServiceUpgradeMode.Auto,
Roles =
{
new CloudServiceRoleProfileProperties()
{
Name = "ContosoFrontend",
Sku = new CloudServiceRoleSku()
{
Name = "Standard_D1_v2",
Tier = "Standard",
Capacity = 1L,
},
}
},
NetworkProfile = new CloudServiceNetworkProfile()
{
LoadBalancerConfigurations =
{
new CloudServiceLoadBalancerConfiguration("contosolb",new LoadBalancerFrontendIPConfiguration[]
{
new LoadBalancerFrontendIPConfiguration("contosofe")
{
PublicIPAddressId = new ResourceIdentifier("/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"),
}
})
},
},
Extensions =
{
new CloudServiceExtension()
{
Name = "RDPExtension",
Publisher = "Microsoft.Windows.Azure.Extensions",
CloudServiceExtensionPropertiesType = "RDP",
TypeHandlerVersion = "1.2",
AutoUpgradeMinorVersion = false,
Settings = BinaryData.FromString("\"<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>\""),
ProtectedSettings = BinaryData.FromString("\"<PrivateConfig><Password>{password}</Password></PrivateConfig>\""),
}
},
};
ArmOperation<CloudServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, cloudServiceName, data);
CloudServiceResource 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
CloudServiceData 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
Örnek yanıt
{
"name": "{cs-name}",
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": []
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"name": "contosolb",
"properties": {
"frontendIpConfigurations": [
{
"name": "contosofe",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
}
}
]
}
}
]
},
"extensionProfile": {
"extensions": [
{
"name": "RDPExtension",
"properties": {
"autoUpgradeMinorVersion": false,
"provisioningState": "Creating",
"rolesAppliedTo": [
"*"
],
"publisher": "Microsoft.Windows.Azure.Extensions",
"type": "RDP",
"typeHandlerVersion": "1.2",
"settings": "<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>"
}
}
]
},
"provisioningState": "Updating",
"uniqueId": "c948cccb-bbfa-4516-a250-c28abc4d0c15"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
}
}
location: https://foo.com/operationstatus
{
"name": "{cs-name}",
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}",
"type": "Microsoft.Compute/cloudServices",
"location": "westus",
"properties": {
"configuration": "{ServiceConfiguration}",
"packageUrl": "{PackageUrl}",
"upgradeMode": "Auto",
"roleProfile": {
"roles": [
{
"name": "ContosoFrontend",
"sku": {
"name": "Standard_D1_v2",
"tier": "Standard",
"capacity": 1
}
}
]
},
"osProfile": {
"secrets": []
},
"networkProfile": {
"loadBalancerConfigurations": [
{
"name": "contosolb",
"properties": {
"frontendIpConfigurations": [
{
"name": "contosofe",
"properties": {
"publicIPAddress": {
"id": "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"
}
}
}
]
}
}
]
},
"extensionProfile": {
"extensions": [
{
"name": "RDPExtension",
"properties": {
"autoUpgradeMinorVersion": false,
"provisioningState": "Creating",
"rolesAppliedTo": [
"*"
],
"publisher": "Microsoft.Windows.Azure.Extensions",
"type": "RDP",
"typeHandlerVersion": "1.2",
"settings": "<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>"
}
}
]
},
"provisioningState": "Creating",
"uniqueId": "c948cccb-bbfa-4516-a250-c28abc4d0c15"
},
"systemData": {
"createdAt": "2020-01-01T17:18:19.1234567Z",
"lastModifiedAt": "2020-01-01T17:18:19.1234567Z"
}
}
Tanımlar
ApiError
API hatası.
Name |
Tür |
Description |
code
|
string
|
Hata kodu.
|
details
|
ApiErrorBase[]
|
Api hata ayrıntıları
|
innererror
|
InnerError
|
Api iç hatası
|
message
|
string
|
Hata iletisi.
|
target
|
string
|
Belirli bir hatanın hedefi.
|
ApiErrorBase
Api hata tabanı.
Name |
Tür |
Description |
code
|
string
|
Hata kodu.
|
message
|
string
|
Hata iletisi.
|
target
|
string
|
Belirli bir hatanın hedefi.
|
CloudError
İşlem hizmetinden bir hata yanıtı.
Name |
Tür |
Description |
error
|
ApiError
|
API hatası.
|
CloudService
Bulut hizmetini açıklar.
Name |
Tür |
Description |
id
|
string
|
Kaynak Kimliği.
|
location
|
string
|
Kaynak konumu.
|
name
|
string
|
Kaynak adı.
|
properties
|
CloudServiceProperties
|
Bulut hizmeti özellikleri
|
systemData
|
SystemData
|
Bu kaynakla ilgili sistem meta verileri.
|
tags
|
object
|
Kaynak etiketleri.
|
type
|
string
|
Kaynak türü.
|
zones
|
string[]
|
Kaynağın mantıksal kullanılabilirlik alanı listesi. Liste, bulut hizmetinin sağlanması gereken yalnızca 1 bölge içermelidir. Bu alan isteğe bağlıdır.
|
CloudServiceExtensionProfile
Bir bulut hizmeti uzantısı profilini açıklar.
Name |
Tür |
Description |
extensions
|
Extension[]
|
Bulut hizmeti için uzantıların listesi.
|
CloudServiceExtensionProperties
Uzantı Özellikleri.
Name |
Tür |
Description |
autoUpgradeMinorVersion
|
boolean
|
Platform kullanılabilir olduğunda typeHandlerVersion'ı otomatik olarak daha yüksek ikincil sürümlere yükseltip yükseltemeyeceğini açıkça belirtin.
|
forceUpdateTag
|
string
|
Sağlanan genel ve korumalı ayarları uygulamaya zorlamak için etiket.
Etiket değerinin değiştirilmesi, genel veya korumalı ayarları değiştirmeden uzantının yeniden çalıştırılmasına olanak tanır.
forceUpdateTag değiştirilmezse, ortak veya korumalı ayarlara yapılan güncelleştirmeler işleyici tarafından yine de uygulanır.
ForceUpdateTag veya genel veya korumalı ayarlardan hiçbiri değişmezse, uzantı aynı sıra numarasına sahip rol örneğine akabilir ve yeniden çalıştırılıp çalıştırılmayacağı işleyici uygulamasına bağlı olur
|
protectedSettings
|
object
|
Rol örneğine gönderilmeden önce şifrelenen uzantının korumalı ayarları.
|
protectedSettingsFromKeyVault
|
CloudServiceVaultAndSecretReference
|
Rol örneğine gönderilmeden önce şifrelenen KeyVault kullanılarak başvurulan uzantının korumalı ayarları.
|
provisioningState
|
string
|
Yalnızca yanıtta görünen sağlama durumu.
|
publisher
|
string
|
Uzantı işleyici yayımcısının adı.
|
rolesAppliedTo
|
string[]
|
Bu uzantıyı uygulamak için isteğe bağlı rol listesi. Özellik belirtilmezse veya '*' belirtilirse, uzantı bulut hizmetindeki tüm rollere uygulanır.
|
settings
|
object
|
Uzantının genel ayarları. JSON uzantıları için bu, uzantının JSON ayarlarıdır. XML Uzantısı (RDP gibi) için bu, uzantının XML ayarıdır.
|
type
|
string
|
Uzantının türünü belirtir.
|
typeHandlerVersion
|
string
|
Uzantının sürümünü belirtir. Uzantının sürümünü belirtir. Bu öğe belirtilmezse veya değer olarak yıldız işareti (*) kullanılırsa, uzantının en son sürümü kullanılır. Değer bir ana sürüm numarası ve ikincil sürüm numarası (X) olarak yıldız işaretiyle belirtilirse, belirtilen ana sürümün en son ikincil sürümü seçilir. Ana sürüm numarası ve ikincil sürüm numarası (X.Y) belirtilirse, belirli uzantı sürümü seçilir. Bir sürüm belirtilirse rol örneğinde otomatik yükseltme gerçekleştirilir.
|
CloudServiceNetworkProfile
Bulut hizmeti için Ağ Profili.
Name |
Tür |
Description |
loadBalancerConfigurations
|
LoadBalancerConfiguration[]
|
Yük dengeleyici yapılandırmalarının listesi. Bulut hizmeti, Genel Yük Dengeleyici ve İç Yük Dengeleyici'ye karşılık gelen en fazla iki yük dengeleyici yapılandırmasına sahip olabilir.
|
slotType
|
CloudServiceSlotType
|
Bulut hizmeti için yuva türü.
Olası değerler şunlardır:
Üretim
Hazırlama
Belirtilmezse, varsayılan değer Üretim'dir.
|
swappableCloudService
|
SubResource
|
Konu bulut hizmetinin değiştirme gerçekleştirebileceği hedef IP'yi içeren bulut hizmetinin kimlik başvurusu. Bu özellik ayarlandıktan sonra güncelleştirilemez. Bu kimlik tarafından başvurulan değiştirilebilir bulut hizmeti mevcut olmalıdır, aksi takdirde bir hata oluşur.
|
CloudServiceOsProfile
Bulut hizmeti için işletim sistemi profilini açıklar.
CloudServiceProperties
Bulut hizmeti özellikleri
Name |
Tür |
Description |
allowModelOverride
|
boolean
|
(İsteğe bağlı) Model/şablonda belirtilen rol sku özelliklerinin (roleProfile.roles.sku) sırasıyla .cscfg ve .csdef içinde belirtilen rol örneği sayısını ve vm boyutunu geçersiz kılıp geçersiz kılmayacağını gösterir.
Varsayılan değer false .
|
configuration
|
string
|
Bulut hizmeti için XML hizmet yapılandırmasını (.cscfg) belirtir.
|
configurationUrl
|
string
|
Blob hizmetindeki hizmet yapılandırmasının konumuna başvuran bir URL belirtir. Hizmet paketi URL'si herhangi bir depolama hesabından Paylaşılan Erişim İmzası (SAS) URI'si olabilir.
Bu salt yazma özelliğidir ve GET çağrılarında döndürülmemektedir.
|
extensionProfile
|
CloudServiceExtensionProfile
|
Bir bulut hizmeti uzantısı profilini açıklar.
|
networkProfile
|
CloudServiceNetworkProfile
|
Bulut hizmeti için Ağ Profili.
|
osProfile
|
CloudServiceOsProfile
|
Bulut hizmeti için işletim sistemi profilini açıklar.
|
packageUrl
|
string
|
Blob hizmetindeki hizmet paketinin konumuna başvuran bir URL belirtir. Hizmet paketi URL'si herhangi bir depolama hesabından Paylaşılan Erişim İmzası (SAS) URI'si olabilir.
Bu salt yazma özelliğidir ve GET çağrılarında döndürülmemektedir.
|
provisioningState
|
string
|
Yalnızca yanıtta görünen sağlama durumu.
|
roleProfile
|
CloudServiceRoleProfile
|
Bulut hizmeti için rol profilini açıklar.
|
startCloudService
|
boolean
|
(İsteğe bağlı) Bulut hizmetinin oluşturulduktan hemen sonra başlatılıp başlatılmayacağını gösterir. Varsayılan değer true .
False ise hizmet modeli yine de dağıtılır, ancak kod hemen çalıştırılmaz. Bunun yerine, siz Başlat'ı çağırana kadar hizmet PoweredOff olur ve bu sırada hizmet başlatılır. Dağıtılan bir hizmet, güçlendirilmiş olsa bile ücrete tabi olmaya devam eder.
|
uniqueId
|
string
|
Bulut hizmetinin benzersiz tanımlayıcısı.
|
upgradeMode
|
CloudServiceUpgradeMode
|
Bulut hizmeti için güncelleştirme modu. Rol örnekleri, hizmet dağıtıldığında etki alanlarını güncelleştirmek için ayrılır. Güncelleştirmeler her güncelleştirme etki alanında el ile veya tüm güncelleştirme etki alanlarında otomatik olarak başlatılabilir.
Olası Değerler şunlardır:
Otomatik
el ile
Eşzamanlı
Belirtilmezse, varsayılan değer Otomatik'tir. El ile olarak ayarlanırsa, güncelleştirmeyi uygulamak için PUT UpdateDomain çağrılmalıdır. Otomatik olarak ayarlanırsa, güncelleştirme her güncelleştirme etki alanına sırayla otomatik olarak uygulanır.
|
CloudServiceRoleProfile
Bulut hizmeti için rol profilini açıklar.
CloudServiceRoleProfileProperties
Rol özelliklerini açıklar.
Name |
Tür |
Description |
name
|
string
|
Kaynak adı.
|
sku
|
CloudServiceRoleSku
|
Bulut hizmeti rolü sku'su açıklanır.
|
CloudServiceRoleSku
Bulut hizmeti rolü sku'su açıklanır.
Name |
Tür |
Description |
capacity
|
integer
|
Bulut hizmetindeki rol örneklerinin sayısını belirtir.
|
name
|
string
|
Sku adı. NOT: Yeni SKU, bulut hizmetinin şu anda üzerinde olduğu donanımda desteklenmiyorsa, bulut hizmetini silip yeniden oluşturmanız veya eski sku'ya geri dönmeniz gerekir.
|
tier
|
string
|
Bulut hizmetinin katmanını belirtir. Olası Değerler şunlardır:
standart
Temel
|
CloudServiceSlotType
Bulut hizmeti için yuva türü.
Olası değerler şunlardır:
Üretim
Hazırlama
Belirtilmezse, varsayılan değer Üretim'dir.
Name |
Tür |
Description |
Production
|
string
|
|
Staging
|
string
|
|
CloudServiceUpgradeMode
Bulut hizmeti için güncelleştirme modu. Rol örnekleri, hizmet dağıtıldığında etki alanlarını güncelleştirmek için ayrılır. Güncelleştirmeler her güncelleştirme etki alanında el ile veya tüm güncelleştirme etki alanlarında otomatik olarak başlatılabilir.
Olası Değerler şunlardır:
Otomatik
el ile
Eşzamanlı
Belirtilmezse, varsayılan değer Otomatik'tir. El ile olarak ayarlanırsa, güncelleştirmeyi uygulamak için PUT UpdateDomain çağrılmalıdır. Otomatik olarak ayarlanırsa, güncelleştirme her güncelleştirme etki alanına sırayla otomatik olarak uygulanır.
Name |
Tür |
Description |
Auto
|
string
|
|
Manual
|
string
|
|
Simultaneous
|
string
|
|
CloudServiceVaultAndSecretReference
Rol örneğine gönderilmeden önce şifrelenen KeyVault kullanılarak başvurulan uzantının korumalı ayarları.
Name |
Tür |
Description |
secretUrl
|
string
|
Uzantının korumalı ayarlarını içeren gizli dizi URL'si
|
sourceVault
|
SubResource
|
Key Vault'un ARM Kaynak Kimliği
|
CloudServiceVaultCertificate
Key Vault'ta tek bir sertifika başvuruyu ve sertifikanın rol örneğinde nerede bulunması gerektiğini açıklar.
Name |
Tür |
Description |
certificateUrl
|
string
|
Bu, Key Vault'a gizli dizi olarak yüklenmiş bir sertifikanın URL'sidir.
|
CloudServiceVaultSecretGroup
Tümü aynı Key Vault'ta bulunan bir sertifika kümesini açıklar.
Name |
Tür |
Description |
sourceVault
|
SubResource
|
VaultCertificates içindeki tüm sertifikaları içeren Key Vault'un göreli URL'si.
|
vaultCertificates
|
CloudServiceVaultCertificate[]
|
SourceVault'ta sertifikalar içeren anahtar kasası başvurularının listesi.
|
Extension
Bir bulut hizmeti Uzantısını açıklar.
InnerError
İç hata ayrıntıları.
Name |
Tür |
Description |
errordetail
|
string
|
İç hata iletisi veya özel durum dökümü.
|
exceptiontype
|
string
|
Özel durum türü.
|
LoadBalancerConfiguration
Yük dengeleyici yapılandırmasını açıklar.
LoadBalancerConfigurationProperties
Yük dengeleyici yapılandırmasının özelliklerini açıklar.
Name |
Tür |
Description |
frontendIpConfigurations
|
LoadBalancerFrontendIpConfiguration[]
|
Yük dengeleyici için kullanılacak ön uç IP'sini belirtir. Yalnızca IPv4 ön uç IP adresi desteklenir. Her yük dengeleyici yapılandırmasının tam olarak bir ön uç IP yapılandırması olmalıdır.
|
LoadBalancerFrontendIpConfiguration
Yük dengeleyici için kullanılacak ön uç IP'sini belirtir. Yalnızca IPv4 ön uç IP adresi desteklenir. Her yük dengeleyici yapılandırmasının tam olarak bir ön uç IP yapılandırması olmalıdır.
Name |
Tür |
Description |
name
|
string
|
Yük dengeleyici tarafından kullanılan ön uç IP yapılandırmaları kümesinde benzersiz olan kaynağın adı. Bu ad kaynağa erişmek için kullanılabilir.
|
properties
|
LoadBalancerFrontendIpConfigurationProperties
|
Yük dengeleyici ön uç ip yapılandırmasının özellikleri.
|
LoadBalancerFrontendIpConfigurationProperties
Bulut hizmeti IP Yapılandırmasını açıklar
Name |
Tür |
Description |
privateIPAddress
|
string
|
IP yapılandırmasının sanal ağ özel IP adresi.
|
publicIPAddress
|
SubResource
|
Genel ip adresi kaynağına başvuru.
|
subnet
|
SubResource
|
Sanal ağ alt ağı kaynağına başvuru.
|
SubResource
Name |
Tür |
Description |
id
|
string
|
Kaynak Kimliği
|
SystemData
Bu kaynakla ilgili sistem meta verileri.
Name |
Tür |
Description |
createdAt
|
string
|
Bulut Hizmeti (genişletilmiş destek) kaynağının oluşturulduğu SAATI UTC olarak belirtir. En düşük api sürümü: 2022-04-04.
|
lastModifiedAt
|
string
|
Bulut Hizmeti (genişletilmiş destek) kaynağının son değiştirildiği UTC saatini belirtir. En düşük api sürümü: 2022-04-04.
|