Create or update a cloud service. Please note some properties can be set only during cloud service creation.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}?api-version=2022-09-04
URI Parameters
Name |
In |
Required |
Type |
Description |
cloudServiceName
|
path |
True
|
string
|
Name of the cloud service.
|
resourceGroupName
|
path |
True
|
string
|
Name of the resource group.
|
subscriptionId
|
path |
True
|
string
|
Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
|
api-version
|
query |
True
|
string
|
Client Api Version.
|
Request Body
Name |
Required |
Type |
Description |
location
|
True
|
string
|
Resource location.
|
properties
|
|
CloudServiceProperties
|
Cloud service properties
|
systemData
|
|
SystemData
|
The system meta data relating to this resource.
|
tags
|
|
object
|
Resource tags.
|
zones
|
|
string[]
|
List of logical availability zone of the resource. List should contain only 1 zone where cloud service should be provisioned. This field is optional.
|
Responses
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
Create New Cloud Service with Multiple Roles
Sample request
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
Sample response
{
"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
Sample request
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
Sample response
{
"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
Sample request
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
Sample response
{
"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
Sample request
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
Sample response
{
"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
Sample request
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
Sample response
{
"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"
}
}
Definitions
ApiError
Api error.
Name |
Type |
Description |
code
|
string
|
The error code.
|
details
|
ApiErrorBase[]
|
The Api error details
|
innererror
|
InnerError
|
The Api inner error
|
message
|
string
|
The error message.
|
target
|
string
|
The target of the particular error.
|
ApiErrorBase
Api error base.
Name |
Type |
Description |
code
|
string
|
The error code.
|
message
|
string
|
The error message.
|
target
|
string
|
The target of the particular error.
|
CloudError
An error response from the Compute service.
Name |
Type |
Description |
error
|
ApiError
|
Api error.
|
CloudService
Describes the cloud service.
Name |
Type |
Description |
id
|
string
|
Resource Id.
|
location
|
string
|
Resource location.
|
name
|
string
|
Resource name.
|
properties
|
CloudServiceProperties
|
Cloud service properties
|
systemData
|
SystemData
|
The system meta data relating to this resource.
|
tags
|
object
|
Resource tags.
|
type
|
string
|
Resource type.
|
zones
|
string[]
|
List of logical availability zone of the resource. List should contain only 1 zone where cloud service should be provisioned. This field is optional.
|
CloudServiceExtensionProfile
Describes a cloud service extension profile.
Name |
Type |
Description |
extensions
|
Extension[]
|
List of extensions for the cloud service.
|
CloudServiceExtensionProperties
Extension Properties.
Name |
Type |
Description |
autoUpgradeMinorVersion
|
boolean
|
Explicitly specify whether platform can automatically upgrade typeHandlerVersion to higher minor versions when they become available.
|
forceUpdateTag
|
string
|
Tag to force apply the provided public and protected settings.
Changing the tag value allows for re-running the extension without changing any of the public or protected settings.
If forceUpdateTag is not changed, updates to public or protected settings would still be applied by the handler.
If neither forceUpdateTag nor any of public or protected settings change, extension would flow to the role instance with the same sequence-number, and
it is up to handler implementation whether to re-run it or not
|
protectedSettings
|
object
|
Protected settings for the extension which are encrypted before sent to the role instance.
|
protectedSettingsFromKeyVault
|
CloudServiceVaultAndSecretReference
|
Protected settings for the extension, referenced using KeyVault which are encrypted before sent to the role instance.
|
provisioningState
|
string
|
The provisioning state, which only appears in the response.
|
publisher
|
string
|
The name of the extension handler publisher.
|
rolesAppliedTo
|
string[]
|
Optional list of roles to apply this extension. If property is not specified or '*' is specified, extension is applied to all roles in the cloud service.
|
settings
|
object
|
Public settings for the extension. For JSON extensions, this is the JSON settings for the extension. For XML Extension (like RDP), this is the XML setting for the extension.
|
type
|
string
|
Specifies the type of the extension.
|
typeHandlerVersion
|
string
|
Specifies the version of the extension. Specifies the version of the extension. If this element is not specified or an asterisk (*) is used as the value, the latest version of the extension is used. If the value is specified with a major version number and an asterisk as the minor version number (X.), the latest minor version of the specified major version is selected. If a major version number and a minor version number are specified (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade is performed on the role instance.
|
CloudServiceNetworkProfile
Network Profile for the cloud service.
Name |
Type |
Description |
loadBalancerConfigurations
|
LoadBalancerConfiguration[]
|
List of Load balancer configurations. Cloud service can have up to two load balancer configurations, corresponding to a Public Load Balancer and an Internal Load Balancer.
|
slotType
|
CloudServiceSlotType
|
Slot type for the cloud service.
Possible values are
Production
Staging
If not specified, the default value is Production.
|
swappableCloudService
|
SubResource
|
The id reference of the cloud service containing the target IP with which the subject cloud service can perform a swap. This property cannot be updated once it is set. The swappable cloud service referred by this id must be present otherwise an error will be thrown.
|
CloudServiceOsProfile
Describes the OS profile for the cloud service.
Name |
Type |
Description |
secrets
|
CloudServiceVaultSecretGroup[]
|
Specifies set of certificates that should be installed onto the role instances.
|
CloudServiceProperties
Cloud service properties
Name |
Type |
Description |
allowModelOverride
|
boolean
|
(Optional) Indicates whether the role sku properties (roleProfile.roles.sku) specified in the model/template should override the role instance count and vm size specified in the .cscfg and .csdef respectively.
The default value is false .
|
configuration
|
string
|
Specifies the XML service configuration (.cscfg) for the cloud service.
|
configurationUrl
|
string
|
Specifies a URL that refers to the location of the service configuration in the Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage account.
This is a write-only property and is not returned in GET calls.
|
extensionProfile
|
CloudServiceExtensionProfile
|
Describes a cloud service extension profile.
|
networkProfile
|
CloudServiceNetworkProfile
|
Network Profile for the cloud service.
|
osProfile
|
CloudServiceOsProfile
|
Describes the OS profile for the cloud service.
|
packageUrl
|
string
|
Specifies a URL that refers to the location of the service package in the Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage account.
This is a write-only property and is not returned in GET calls.
|
provisioningState
|
string
|
The provisioning state, which only appears in the response.
|
roleProfile
|
CloudServiceRoleProfile
|
Describes the role profile for the cloud service.
|
startCloudService
|
boolean
|
(Optional) Indicates whether to start the cloud service immediately after it is created. The default value is true .
If false, the service model is still deployed, but the code is not run immediately. Instead, the service is PoweredOff until you call Start, at which time the service will be started. A deployed service still incurs charges, even if it is poweredoff.
|
uniqueId
|
string
|
The unique identifier for the cloud service.
|
upgradeMode
|
CloudServiceUpgradeMode
|
Update mode for the cloud service. Role instances are allocated to update domains when the service is deployed. Updates can be initiated manually in each update domain or initiated automatically in all update domains.
Possible Values are
Auto
Manual
Simultaneous
If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called to apply the update. If set to Auto, the update is automatically applied to each update domain in sequence.
|
CloudServiceRoleProfile
Describes the role profile for the cloud service.
CloudServiceRoleProfileProperties
Describes the role properties.
Name |
Type |
Description |
name
|
string
|
Resource name.
|
sku
|
CloudServiceRoleSku
|
Describes the cloud service role sku.
|
CloudServiceRoleSku
Describes the cloud service role sku.
Name |
Type |
Description |
capacity
|
integer
|
Specifies the number of role instances in the cloud service.
|
name
|
string
|
The sku name. NOTE: If the new SKU is not supported on the hardware the cloud service is currently on, you need to delete and recreate the cloud service or move back to the old sku.
|
tier
|
string
|
Specifies the tier of the cloud service. Possible Values are
Standard
Basic
|
CloudServiceSlotType
Slot type for the cloud service.
Possible values are
Production
Staging
If not specified, the default value is Production.
Name |
Type |
Description |
Production
|
string
|
|
Staging
|
string
|
|
CloudServiceUpgradeMode
Update mode for the cloud service. Role instances are allocated to update domains when the service is deployed. Updates can be initiated manually in each update domain or initiated automatically in all update domains.
Possible Values are
Auto
Manual
Simultaneous
If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called to apply the update. If set to Auto, the update is automatically applied to each update domain in sequence.
Name |
Type |
Description |
Auto
|
string
|
|
Manual
|
string
|
|
Simultaneous
|
string
|
|
CloudServiceVaultAndSecretReference
Protected settings for the extension, referenced using KeyVault which are encrypted before sent to the role instance.
Name |
Type |
Description |
secretUrl
|
string
|
Secret URL which contains the protected settings of the extension
|
sourceVault
|
SubResource
|
The ARM Resource ID of the Key Vault
|
CloudServiceVaultCertificate
Describes a single certificate reference in a Key Vault, and where the certificate should reside on the role instance.
Name |
Type |
Description |
certificateUrl
|
string
|
This is the URL of a certificate that has been uploaded to Key Vault as a secret.
|
CloudServiceVaultSecretGroup
Describes a set of certificates which are all in the same Key Vault.
Name |
Type |
Description |
sourceVault
|
SubResource
|
The relative URL of the Key Vault containing all of the certificates in VaultCertificates.
|
vaultCertificates
|
CloudServiceVaultCertificate[]
|
The list of key vault references in SourceVault which contain certificates.
|
Extension
Describes a cloud service Extension.
InnerError
Inner error details.
Name |
Type |
Description |
errordetail
|
string
|
The internal error message or exception dump.
|
exceptiontype
|
string
|
The exception type.
|
LoadBalancerConfiguration
Describes the load balancer configuration.
Name |
Type |
Description |
id
|
string
|
Resource Id
|
name
|
string
|
The name of the Load balancer
|
properties
|
LoadBalancerConfigurationProperties
|
Properties of the load balancer configuration.
|
LoadBalancerConfigurationProperties
Describes the properties of the load balancer configuration.
Name |
Type |
Description |
frontendIpConfigurations
|
LoadBalancerFrontendIpConfiguration[]
|
Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must have exactly one frontend IP configuration.
|
LoadBalancerFrontendIpConfiguration
Specifies the frontend IP to be used for the load balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must have exactly one frontend IP configuration.
Name |
Type |
Description |
name
|
string
|
The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name can be used to access the resource.
|
properties
|
LoadBalancerFrontendIpConfigurationProperties
|
Properties of load balancer frontend ip configuration.
|
LoadBalancerFrontendIpConfigurationProperties
Describes a cloud service IP Configuration
Name |
Type |
Description |
privateIPAddress
|
string
|
The virtual network private IP address of the IP configuration.
|
publicIPAddress
|
SubResource
|
The reference to the public ip address resource.
|
subnet
|
SubResource
|
The reference to the virtual network subnet resource.
|
SubResource
Name |
Type |
Description |
id
|
string
|
Resource Id
|
SystemData
The system meta data relating to this resource.
Name |
Type |
Description |
createdAt
|
string
|
Specifies the time in UTC at which the Cloud Service (extended support) resource was created. Minimum api-version: 2022-04-04.
|
lastModifiedAt
|
string
|
Specifies the time in UTC at which the Cloud Service (extended support) resource was last modified. Minimum api-version: 2022-04-04.
|