Felhőszolgáltatás létrehozása vagy frissítése. Vegye figyelembe, hogy egyes tulajdonságok csak a felhőszolgáltatás létrehozásakor állíthatók be.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}?api-version=2024-11-04
URI-paraméterek
Name |
In |
Kötelező |
Típus |
Description |
cloudServiceName
|
path |
True
|
string
|
A felhőszolgáltatás neve.
|
resourceGroupName
|
path |
True
|
string
|
Az erőforráscsoport neve.
|
subscriptionId
|
path |
True
|
string
|
Az előfizetés hitelesítő adatai, amelyek egyedileg azonosítják a Microsoft Azure-előfizetést. Az előfizetés azonosítója minden szolgáltatáshíváshoz az URI részét képezi.
|
api-version
|
query |
True
|
string
|
Ügyfél API-verziója.
|
Kérelem törzse
Name |
Kötelező |
Típus |
Description |
location
|
True
|
string
|
Erőforrás helye.
|
properties
|
|
CloudServiceProperties
|
Felhőszolgáltatás tulajdonságai
|
systemData
|
|
SystemData
|
Az erőforráshoz kapcsolódó rendszer metaadatai.
|
tags
|
|
object
|
Erőforráscímkék.
|
zones
|
|
string[]
|
Az erőforrás logikai rendelkezésre állási zónájának listája. A listának csak 1 zónát kell tartalmaznia, ahol a felhőszolgáltatást ki kell építeni. Ez a mező nem kötelező.
|
Válaszok
Biztonság
azure_auth
Azure Active Directory OAuth2 Flow
Típus:
oauth2
Folyamat:
implicit
Engedélyezési URL:
https://login.microsoftonline.com/common/oauth2/authorize
Hatókörök
Name |
Description |
user_impersonation
|
a felhasználói fiók megszemélyesítése
|
Példák
Create New Cloud Service with Multiple Roles
Mintakérelem
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2024-11-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/2024-11-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
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python cloud_service_create_with_multi_role.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.cloud_services.begin_create_or_update(
resource_group_name="ConstosoRG",
cloud_service_name="{cs-name}",
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithMultiRole.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/250861bb6a886b75255edfa0aa5ee2dd0d6e7a11/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-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");
require("dotenv/config");
/**
* 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/2024-11-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/2024-11-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
Mintaválasz
{
"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
Mintakérelem
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2024-11-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/2024-11-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
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python cloud_service_create_with_multi_role_with_zones.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.cloud_services.begin_create_or_update(
resource_group_name="ConstosoRG",
cloud_service_name="{cs-name}",
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithMultiRole_WithZones.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/250861bb6a886b75255edfa0aa5ee2dd0d6e7a11/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-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");
require("dotenv/config");
/**
* 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/2024-11-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/2024-11-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
Mintaválasz
{
"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
Mintakérelem
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2024-11-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/2024-11-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
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python cloud_service_create_with_single_role.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.cloud_services.begin_create_or_update(
resource_group_name="ConstosoRG",
cloud_service_name="{cs-name}",
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRole.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/250861bb6a886b75255edfa0aa5ee2dd0d6e7a11/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-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");
require("dotenv/config");
/**
* 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/2024-11-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/2024-11-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
Mintaválasz
{
"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
Mintakérelem
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2024-11-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}",
"isBootstrapCertificate": true
}
]
}
]
},
"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/2024-11-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}")
.withIsBootstrapCertificate(true))))))
.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
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python cloud_service_create_with_single_role_and_certificate.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.cloud_services.begin_create_or_update(
resource_group_name="ConstosoRG",
cloud_service_name="{cs-name}",
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRoleAndCertificate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/250861bb6a886b75255edfa0aa5ee2dd0d6e7a11/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-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}"),
IsBootstrapCertificate: to.Ptr(true),
}},
}},
},
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}"),
// IsBootstrapCertificate: to.Ptr(true),
// }},
// }},
// },
// 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");
require("dotenv/config");
/**
* 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/2024-11-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}",
isBootstrapCertificate: true,
},
],
},
],
},
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/2024-11-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}"),
IsBootstrapCertificate = true,
}},
}},
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
Mintaválasz
{
"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}",
"isBootstrapCertificate": true
}
]
}
]
},
"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}",
"isBootstrapCertificate": true
}
]
}
]
},
"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
Mintakérelem
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Compute/cloudServices/{cs-name}?api-version=2024-11-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/2024-11-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
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python cloud_service_create_with_single_role_and_rdp.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.cloud_services.begin_create_or_update(
resource_group_name="ConstosoRG",
cloud_service_name="{cs-name}",
).result()
print(response)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples/CloudService_Create_WithSingleRoleAndRDP.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v6"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/250861bb6a886b75255edfa0aa5ee2dd0d6e7a11/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-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");
require("dotenv/config");
/**
* 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/2024-11-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/2024-11-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.FromObjectAsJson("<PublicConfig><UserName>UserAzure</UserName><Expiration>10/22/2021 15:05:45</Expiration></PublicConfig>"),
ProtectedSettings = BinaryData.FromObjectAsJson("<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
Mintaválasz
{
"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"
}
}
Definíciók
Name |
Description |
ApiError
|
Api-hiba.
|
ApiErrorBase
|
Api-hibabázis.
|
CloudError
|
Hibaválasz a Compute szolgáltatástól.
|
CloudService
|
A felhőszolgáltatást ismerteti.
|
CloudServiceExtensionProfile
|
Egy felhőszolgáltatás-bővítményprofil ismertetése.
|
CloudServiceExtensionProperties
|
Bővítmény tulajdonságai.
|
CloudServiceNetworkProfile
|
A felhőszolgáltatás hálózati profilja.
|
CloudServiceOsProfile
|
A felhőszolgáltatás operációsrendszer-profilját ismerteti.
|
CloudServiceProperties
|
Felhőszolgáltatás tulajdonságai
|
CloudServiceRoleProfile
|
A felhőszolgáltatás szerepkörprofiljának ismertetése.
|
CloudServiceRoleProfileProperties
|
A szerepkör tulajdonságainak leírása.
|
CloudServiceRoleSku
|
A felhőszolgáltatás szerepkör-termékváltozatát ismerteti.
|
CloudServiceSlotType
|
A felhőszolgáltatás ponttípusa.
A lehetséges értékek a következők:
Éles
átmeneti
Ha nincs megadva, az alapértelmezett érték az Éles környezet.
|
CloudServiceUpgradeMode
|
Frissítési mód a felhőszolgáltatáshoz. A szerepkörpéldányok a szolgáltatás üzembe helyezésekor a tartományok frissítéséhez vannak lefoglalva. A frissítések manuálisan indíthatók minden frissítési tartományban, vagy automatikusan kezdeményezhetők az összes frissítési tartományban.
A lehetséges értékek a következők:
automatikus
Kézikönyv
Egyidejű
Ha nincs megadva, az alapértelmezett érték az Automatikus érték. Ha manuális értékre van állítva, a PUT UpdateDomain-t meg kell hívni a frissítés alkalmazásához. Ha automatikus értékre van állítva, a rendszer automatikusan alkalmazza a frissítést az egyes frissítési tartományokra egymás után.
|
CloudServiceVaultAndSecretReference
|
A bővítmény védett beállításai, amelyekre a KeyVault használatával hivatkozunk, amelyek titkosítva vannak, mielőtt elküldené őket a szerepkörpéldánynak.
|
CloudServiceVaultCertificate
|
A Key Vault egyetlen tanúsítványhivatkozását ismerteti, és azt, hogy a tanúsítványnak hol kell lennie a szerepkörpéldányon.
|
CloudServiceVaultSecretGroup
|
Egy olyan tanúsítványkészletet ír le, amely ugyanabban a Key Vaultban található.
|
Extension
|
Egy felhőalapú szolgáltatásbővítményt ismertet.
|
InnerError
|
Belső hiba részletei.
|
LoadBalancerConfiguration
|
A terheléselosztó konfigurációját ismerteti.
|
LoadBalancerConfigurationProperties
|
A terheléselosztó konfigurációjának tulajdonságait ismerteti.
|
LoadBalancerFrontendIpConfiguration
|
Megadja a terheléselosztóhoz használandó előtérbeli IP-címet. Csak az IPv4 előtér IP-címe támogatott. Minden terheléselosztó-konfigurációnak pontosan egy előtérbeli IP-konfigurációval kell rendelkeznie.
|
LoadBalancerFrontendIpConfigurationProperties
|
A felhőszolgáltatás IP-konfigurációjának ismertetése
|
SubResource
|
|
SystemData
|
Az erőforráshoz kapcsolódó rendszer metaadatai.
|
ApiError
Objektum
Api-hiba.
Name |
Típus |
Description |
code
|
string
|
A hibakód.
|
details
|
ApiErrorBase[]
|
Az API-hiba részletei
|
innererror
|
InnerError
|
Az Api belső hibája
|
message
|
string
|
A hibaüzenet.
|
target
|
string
|
Az adott hiba célja.
|
ApiErrorBase
Objektum
Api-hibabázis.
Name |
Típus |
Description |
code
|
string
|
A hibakód.
|
message
|
string
|
A hibaüzenet.
|
target
|
string
|
Az adott hiba célja.
|
CloudError
Objektum
Hibaválasz a Compute szolgáltatástól.
Name |
Típus |
Description |
error
|
ApiError
|
Api-hiba.
|
CloudService
Objektum
A felhőszolgáltatást ismerteti.
Name |
Típus |
Description |
id
|
string
|
Erőforrás-azonosító.
|
location
|
string
|
Erőforrás helye.
|
name
|
string
|
Erőforrás neve.
|
properties
|
CloudServiceProperties
|
Felhőszolgáltatás tulajdonságai
|
systemData
|
SystemData
|
Az erőforráshoz kapcsolódó rendszer metaadatai.
|
tags
|
object
|
Erőforráscímkék.
|
type
|
string
|
Erőforrás típusa.
|
zones
|
string[]
|
Az erőforrás logikai rendelkezésre állási zónájának listája. A listának csak 1 zónát kell tartalmaznia, ahol a felhőszolgáltatást ki kell építeni. Ez a mező nem kötelező.
|
CloudServiceExtensionProfile
Objektum
Egy felhőszolgáltatás-bővítményprofil ismertetése.
Name |
Típus |
Description |
extensions
|
Extension[]
|
A felhőszolgáltatás bővítményeinek listája.
|
CloudServiceExtensionProperties
Objektum
Bővítmény tulajdonságai.
Name |
Típus |
Description |
autoUpgradeMinorVersion
|
boolean
|
Explicit módon adja meg, hogy a platform képes-e automatikusan frissíteni a TypeHandlerVersion típust a magasabb alverziókra, amikor elérhetővé válnak.
|
forceUpdateTag
|
string
|
A megadott nyilvános és védett beállítások kényszerítéséhez használja a címkét.
A címke értékének módosítása lehetővé teszi a bővítmény újrafuttatását a nyilvános vagy védett beállítások módosítása nélkül.
Ha a forceUpdateTag nem módosul, a kezelő továbbra is alkalmazza a nyilvános vagy védett beállítások frissítéseit.
Ha sem a forceUpdateTag, sem a nyilvános vagy védett beállítások nem változnak, a bővítmény ugyanazzal a sorszámmal áramlik a szerepkörpéldányra, és a kezelőn múlik, hogy újra futtatja-e vagy sem.
|
protectedSettings
|
object
|
A szerepkörpéldánynak való küldés előtt titkosított bővítmény védett beállításai.
|
protectedSettingsFromKeyVault
|
CloudServiceVaultAndSecretReference
|
A bővítmény védett beállításai, amelyekre a KeyVault használatával hivatkozunk, amelyek titkosítva vannak, mielőtt elküldené őket a szerepkörpéldánynak.
|
provisioningState
|
string
|
A kiépítési állapot, amely csak a válaszban jelenik meg.
|
publisher
|
string
|
A bővítménykezelő közzétevőjének neve.
|
rolesAppliedTo
|
string[]
|
Nem kötelező a bővítmény alkalmazásához szükséges szerepkörök listája. Ha a tulajdonság nincs megadva, vagy a "*" meg van adva, a bővítmény a felhőszolgáltatás összes szerepkörére vonatkozik.
|
settings
|
object
|
A bővítmény nyilvános beállításai. JSON-bővítmények esetén ez a bővítmény JSON-beállításai. Az XML-bővítmény (például RDP) esetében ez a bővítmény XML-beállítása.
|
type
|
string
|
A bővítmény típusát adja meg.
|
typeHandlerVersion
|
string
|
A bővítmény verzióját adja meg. A bővítmény verzióját adja meg. Ha ez az elem nincs megadva, vagy csillagot (*) használ az értékként, a bővítmény legújabb verzióját használja a rendszer. Ha az érték főverziószámmal és csillaggal van megadva alverziószámként (X.), a megadott főverzió legújabb alverziója lesz kiválasztva. Ha egy főverziószám és egy alverziószám van megadva (X.Y), a bővítmény adott verziója lesz kiválasztva. Ha meg van adva verzió, automatikus frissítés történik a szerepkörpéldányon.
|
CloudServiceNetworkProfile
Objektum
A felhőszolgáltatás hálózati profilja.
Name |
Típus |
Description |
loadBalancerConfigurations
|
LoadBalancerConfiguration[]
|
A Terheléselosztó konfigurációinak listája. A felhőszolgáltatás legfeljebb két terheléselosztó konfigurációval rendelkezhet, amelyek egy nyilvános terheléselosztónak és egy belső terheléselosztónak felelnek meg.
|
slotType
|
CloudServiceSlotType
|
A felhőszolgáltatás ponttípusa.
A lehetséges értékek a következők:
Éles
átmeneti
Ha nincs megadva, az alapértelmezett érték az Éles környezet.
|
swappableCloudService
|
SubResource
|
Annak a felhőszolgáltatásnak az azonosítóhivatkozása, amely tartalmazza azt a cél IP-címet, amellyel az érintett felhőszolgáltatás felcserélhető. Ez a tulajdonság a beállítás után nem frissíthető. Az azonosító által hivatkozott cserélhető felhőszolgáltatásnak jelen kell lennie, különben hibaüzenet jelenik meg.
|
CloudServiceOsProfile
Objektum
A felhőszolgáltatás operációsrendszer-profilját ismerteti.
CloudServiceProperties
Objektum
Felhőszolgáltatás tulajdonságai
Name |
Típus |
Description |
allowModelOverride
|
boolean
|
(Nem kötelező) Azt jelzi, hogy a modellben/sablonban megadott szerepkör-termékváltozat tulajdonságainak (roleProfile.role.sku) felül kell-e bírálnia a .cscfg és a .csdef szerepkörpéldányok számát és virtuálisgép-méretét.
Az alapértelmezett érték a false .
|
configuration
|
string
|
Megadja a felhőszolgáltatás XML-szolgáltatáskonfigurációját (.cscfg).
|
configurationUrl
|
string
|
Olyan URL-címet ad meg, amely a blobszolgáltatás szolgáltatáskonfigurációjának helyére hivatkozik. A szolgáltatáscsomag URL-címe bármely tárfiók megosztott hozzáférésű jogosultságkódja (SAS) URI lehet.
Ez egy írásvédett tulajdonság, és a GET-hívások nem adják vissza.
|
extensionProfile
|
CloudServiceExtensionProfile
|
Egy felhőszolgáltatás-bővítményprofil ismertetése.
|
networkProfile
|
CloudServiceNetworkProfile
|
A felhőszolgáltatás hálózati profilja.
|
osProfile
|
CloudServiceOsProfile
|
A felhőszolgáltatás operációsrendszer-profilját ismerteti.
|
packageUrl
|
string
|
Olyan URL-címet ad meg, amely a szolgáltatáscsomag blobszolgáltatásban való helyére hivatkozik. A szolgáltatáscsomag URL-címe bármely tárfiók megosztott hozzáférésű jogosultságkódja (SAS) URI lehet.
Ez egy írásvédett tulajdonság, és a GET-hívások nem adják vissza.
|
provisioningState
|
string
|
A kiépítési állapot, amely csak a válaszban jelenik meg.
|
roleProfile
|
CloudServiceRoleProfile
|
A felhőszolgáltatás szerepkörprofiljának ismertetése.
|
startCloudService
|
boolean
|
(Nem kötelező) Azt jelzi, hogy a felhőszolgáltatást közvetlenül a létrehozása után kell-e elindítani. Az alapértelmezett érték a true .
Ha hamis, a szolgáltatásmodell továbbra is üzembe van helyezve, de a kód nem fut azonnal. Ehelyett a szolgáltatás a PoweredOff lesz, amíg meg nem hívja a Startot, és ekkor elindul a szolgáltatás. Az üzembe helyezett szolgáltatások továbbra is díjakat vonnak maga után, még akkor is, ha az ki van kapcsolva.
|
uniqueId
|
string
|
A felhőszolgáltatás egyedi azonosítója.
|
upgradeMode
|
CloudServiceUpgradeMode
|
Frissítési mód a felhőszolgáltatáshoz. A szerepkörpéldányok a szolgáltatás üzembe helyezésekor a tartományok frissítéséhez vannak lefoglalva. A frissítések manuálisan indíthatók minden frissítési tartományban, vagy automatikusan kezdeményezhetők az összes frissítési tartományban.
A lehetséges értékek a következők:
automatikus
Kézikönyv
Egyidejű
Ha nincs megadva, az alapértelmezett érték az Automatikus érték. Ha manuális értékre van állítva, a PUT UpdateDomain-t meg kell hívni a frissítés alkalmazásához. Ha automatikus értékre van állítva, a rendszer automatikusan alkalmazza a frissítést az egyes frissítési tartományokra egymás után.
|
CloudServiceRoleProfile
Objektum
A felhőszolgáltatás szerepkörprofiljának ismertetése.
CloudServiceRoleProfileProperties
Objektum
A szerepkör tulajdonságainak leírása.
Name |
Típus |
Description |
name
|
string
|
Erőforrás neve.
|
sku
|
CloudServiceRoleSku
|
A felhőszolgáltatás szerepkör-termékváltozatát ismerteti.
|
CloudServiceRoleSku
Objektum
A felhőszolgáltatás szerepkör-termékváltozatát ismerteti.
Name |
Típus |
Description |
capacity
|
integer
(int64)
|
A felhőszolgáltatás szerepkörpéldányainak számát adja meg.
|
name
|
string
|
A termékváltozat neve. MEGJEGYZÉS: Ha az új termékváltozat nem támogatott azon a hardveren, amelyen a felhőszolgáltatás jelenleg működik, törölnie kell és újra létre kell hoznia a felhőszolgáltatást, vagy vissza kell lépnie a régi termékváltozatra.
|
tier
|
string
|
Megadja a felhőszolgáltatás szintjét. A lehetséges értékek a következők:
Szabvány
Alapszintű
|
CloudServiceSlotType
Enumerálás
A felhőszolgáltatás ponttípusa.
A lehetséges értékek a következők:
Éles
átmeneti
Ha nincs megadva, az alapértelmezett érték az Éles környezet.
Érték |
Description |
Production
|
|
Staging
|
|
CloudServiceUpgradeMode
Enumerálás
Frissítési mód a felhőszolgáltatáshoz. A szerepkörpéldányok a szolgáltatás üzembe helyezésekor a tartományok frissítéséhez vannak lefoglalva. A frissítések manuálisan indíthatók minden frissítési tartományban, vagy automatikusan kezdeményezhetők az összes frissítési tartományban.
A lehetséges értékek a következők:
automatikus
Kézikönyv
Egyidejű
Ha nincs megadva, az alapértelmezett érték az Automatikus érték. Ha manuális értékre van állítva, a PUT UpdateDomain-t meg kell hívni a frissítés alkalmazásához. Ha automatikus értékre van állítva, a rendszer automatikusan alkalmazza a frissítést az egyes frissítési tartományokra egymás után.
Érték |
Description |
Auto
|
|
Manual
|
|
Simultaneous
|
|
CloudServiceVaultAndSecretReference
Objektum
A bővítmény védett beállításai, amelyekre a KeyVault használatával hivatkozunk, amelyek titkosítva vannak, mielőtt elküldené őket a szerepkörpéldánynak.
Name |
Típus |
Description |
secretUrl
|
string
|
Titkos URL-cím, amely a bővítmény védett beállításait tartalmazza
|
sourceVault
|
SubResource
|
A Key Vault ARM-erőforrásazonosítója
|
CloudServiceVaultCertificate
Objektum
A Key Vault egyetlen tanúsítványhivatkozását ismerteti, és azt, hogy a tanúsítványnak hol kell lennie a szerepkörpéldányon.
Name |
Típus |
Description |
certificateUrl
|
string
|
Ez egy tanúsítvány URL-címe, amelyet titkos kulcsként töltöttek fel a Key Vaultba.
|
isBootstrapCertificate
|
boolean
|
Jelző, amely jelzi, hogy a megadott tanúsítvány egy bootstrap-tanúsítvány, amelyet a Key Vault-bővítmény használ a fennmaradó tanúsítványok lekéréséhez.
|
CloudServiceVaultSecretGroup
Objektum
Egy olyan tanúsítványkészletet ír le, amely ugyanabban a Key Vaultban található.
Name |
Típus |
Description |
sourceVault
|
SubResource
|
A Key Vault relatív URL-címe, amely a VaultCertificates összes tanúsítványát tartalmazza.
|
vaultCertificates
|
CloudServiceVaultCertificate[]
|
A tanúsítványokat tartalmazó Key Vault-hivatkozások listája a SourceVaultban.
|
Extension
Objektum
Egy felhőalapú szolgáltatásbővítményt ismertet.
InnerError
Objektum
Belső hiba részletei.
Name |
Típus |
Description |
errordetail
|
string
|
A belső hibaüzenet vagy kivételkép.
|
exceptiontype
|
string
|
A kivétel típusa.
|
LoadBalancerConfiguration
Objektum
A terheléselosztó konfigurációját ismerteti.
Name |
Típus |
Description |
id
|
string
|
Erőforrás-azonosító
|
name
|
string
|
A terheléselosztó neve
|
properties
|
LoadBalancerConfigurationProperties
|
A terheléselosztó konfigurációjának tulajdonságai.
|
LoadBalancerConfigurationProperties
Objektum
A terheléselosztó konfigurációjának tulajdonságait ismerteti.
Name |
Típus |
Description |
frontendIpConfigurations
|
LoadBalancerFrontendIpConfiguration[]
|
Megadja a terheléselosztóhoz használandó előtérbeli IP-címet. Csak az IPv4 előtér IP-címe támogatott. Minden terheléselosztó-konfigurációnak pontosan egy előtérbeli IP-konfigurációval kell rendelkeznie.
|
LoadBalancerFrontendIpConfiguration
Objektum
Megadja a terheléselosztóhoz használandó előtérbeli IP-címet. Csak az IPv4 előtér IP-címe támogatott. Minden terheléselosztó-konfigurációnak pontosan egy előtérbeli IP-konfigurációval kell rendelkeznie.
Name |
Típus |
Description |
name
|
string
|
A terheléselosztó által használt előtér-IP-konfigurációkon belül egyedi erőforrás neve. Ez a név használható az erőforrás eléréséhez.
|
properties
|
LoadBalancerFrontendIpConfigurationProperties
|
A terheléselosztó előtérbeli IP-konfigurációjának tulajdonságai.
|
LoadBalancerFrontendIpConfigurationProperties
Objektum
A felhőszolgáltatás IP-konfigurációjának ismertetése
Name |
Típus |
Description |
privateIPAddress
|
string
|
Az IP-konfiguráció virtuális hálózatának privát IP-címe.
|
publicIPAddress
|
SubResource
|
A nyilvános IP-cím erőforrásra mutató hivatkozás.
|
subnet
|
SubResource
|
A virtuális hálózati alhálózati erőforrásra mutató hivatkozás.
|
SubResource
Objektum
Name |
Típus |
Description |
id
|
string
|
Erőforrás-azonosító
|
SystemData
Objektum
Az erőforráshoz kapcsolódó rendszer metaadatai.
Name |
Típus |
Description |
createdAt
|
string
(date-time)
|
Azt az időpontot adja meg UTC-ben, amikor a Cloud Service (kiterjesztett támogatás) erőforrás létrejött. Minimális API-verzió: 2022-04-04.
|
lastModifiedAt
|
string
(date-time)
|
Azt az időpontot adja meg UTC-ben, amikor a Cloud Service (kiterjesztett támogatás) erőforrás utoljára módosult. Minimális API-verzió: 2022-04-04.
|