기존 CommunicationService를 업데이트하는 작업입니다.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}?api-version=2023-04-01
URI 매개 변수
Name |
In(다음 안에) |
필수 |
형식 |
Description |
communicationServiceName
|
path |
True
|
string
|
CommunicationService 리소스의 이름입니다.
regex 패턴: ^[-\w]+$
|
resourceGroupName
|
path |
True
|
string
|
리소스 그룹의 이름입니다. 이름은 대/소문자를 구분하지 않습니다.
|
subscriptionId
|
path |
True
|
string
uuid
|
대상 구독의 ID입니다. 값은 UUID여야 합니다.
|
api-version
|
query |
True
|
string
|
이 작업에 사용할 API 버전입니다.
|
요청 본문
Name |
형식 |
Description |
identity
|
ManagedServiceIdentity
|
관리 서비스 ID(시스템 할당 및/또는 사용자 할당 ID)
|
properties.linkedDomains
|
string[]
|
전자 메일 도메인 리소스 ID 목록입니다.
|
tags
|
object
|
리소스를 설명하는 키 값 쌍 목록인 서비스의 태그입니다.
|
응답
예제
Update resource
샘플 요청
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
}
}
import com.azure.resourcemanager.communication.models.CommunicationServiceResource;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentity;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType;
import com.azure.resourcemanager.communication.models.UserAssignedIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for CommunicationServices Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/update.json
*/
/**
* Sample code: Update resource.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResource(com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal")).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateRemoveSystemIdentity.json
*/
/**
* Sample code: Update resource to remove identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void
updateResourceToRemoveIdentity(com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithSystemAndUserIdentity.json
*/
/**
* Sample code: Update resource to add System and User managed identities.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddSystemAndUserManagedIdentities(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(
new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)
.withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity())))
.apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update.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 = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={"tags": {"newTag": "newVal"}},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/update.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 armcommunication_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/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/update.json
func ExampleServicesClient_Update_updateResource() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Identity: &armcommunication.ManagedServiceIdentity{
// Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeNone),
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communications.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// Version: to.Ptr("0.2.0"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/update.json
*/
async function updateResource() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
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 System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/update.json
// this example is just showing the usage of "CommunicationServices_Update" 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 CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// 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
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"id": "/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource",
"name": "MyCommunicationResource",
"type": "Microsoft.Communication/CommunicationServices",
"location": "Global",
"tags": {
"newTag": "newVal"
},
"properties": {
"provisioningState": "Succeeded",
"dataLocation": "United States",
"hostName": "mycommunicationresource.communications.azure.com",
"version": "0.2.0"
},
"identity": {
"type": "None"
}
}
Update resource to add a System Assigned managed identity
샘플 요청
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
},
"identity": {
"type": "SystemAssigned"
}
}
import com.azure.resourcemanager.communication.models.CommunicationServiceResource;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentity;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType;
import com.azure.resourcemanager.communication.models.UserAssignedIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for CommunicationServices Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithSystemAssignedIdentity.json
*/
/**
* Sample code: Update resource to add a System Assigned managed identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddASystemAssignedManagedIdentity(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateRemoveSystemIdentity.json
*/
/**
* Sample code: Update resource to remove identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void
updateResourceToRemoveIdentity(com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithSystemAndUserIdentity.json
*/
/**
* Sample code: Update resource to add System and User managed identities.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddSystemAndUserManagedIdentities(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(
new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)
.withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity())))
.apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update_with_system_assigned_identity.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 = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={"identity": {"type": "SystemAssigned"}, "tags": {"newTag": "newVal"}},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAssignedIdentity.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 armcommunication_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/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAssignedIdentity.json
func ExampleServicesClient_Update_updateResourceToAddASystemAssignedManagedIdentity() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
Identity: &armcommunication.ManagedServiceIdentity{
Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssigned),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Identity: &armcommunication.ManagedServiceIdentity{
// Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"),
// TenantID: to.Ptr("22222222-2222-2222-2222-222222222222"),
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communications.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// Version: to.Ptr("0.2.0"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAssignedIdentity.json
*/
async function updateResourceToAddASystemAssignedManagedIdentity() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
identity: { type: "SystemAssigned" },
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
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 System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAssignedIdentity.json
// this example is just showing the usage of "CommunicationServices_Update" 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 CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Identity = new ManagedServiceIdentity("SystemAssigned"),
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// 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
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"id": "/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource",
"name": "MyCommunicationResource",
"type": "Microsoft.Communication/CommunicationServices",
"location": "Global",
"tags": {
"newTag": "newVal"
},
"properties": {
"provisioningState": "Succeeded",
"dataLocation": "United States",
"hostName": "mycommunicationresource.communications.azure.com",
"version": "0.2.0"
},
"identity": {
"type": "SystemAssigned",
"principalId": "11111111-1111-1111-1111-111111111111",
"tenantId": "22222222-2222-2222-2222-222222222222"
}
}
Update resource to add a User Assigned managed identity
샘플 요청
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/user/assigned/resource/id": {}
}
}
}
import com.azure.resourcemanager.communication.models.CommunicationServiceResource;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentity;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType;
import com.azure.resourcemanager.communication.models.UserAssignedIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for CommunicationServices Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithUserAssignedIdentity.json
*/
/**
* Sample code: Update resource to add a User Assigned managed identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddAUserAssignedManagedIdentity(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity())))
.apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateRemoveSystemIdentity.json
*/
/**
* Sample code: Update resource to remove identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void
updateResourceToRemoveIdentity(com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithSystemAndUserIdentity.json
*/
/**
* Sample code: Update resource to add System and User managed identities.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddSystemAndUserManagedIdentities(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(
new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)
.withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity())))
.apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
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.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update_with_user_assigned_identity.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 = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={
"identity": {"type": "UserAssigned", "userAssignedIdentities": {"/user/assigned/resource/id": {}}},
"tags": {"newTag": "newVal"},
},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithUserAssignedIdentity.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 armcommunication_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/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithUserAssignedIdentity.json
func ExampleServicesClient_Update_updateResourceToAddAUserAssignedManagedIdentity() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
Identity: &armcommunication.ManagedServiceIdentity{
Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{
"/user/assigned/resource/id": {},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Identity: &armcommunication.ManagedServiceIdentity{
// Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{
// "/user/assigned/resource/id": &armcommunication.UserAssignedIdentity{
// ClientID: to.Ptr("11112222-3333-4444-5555-666677778888"),
// PrincipalID: to.Ptr("11112222-3333-4444-5555-666677778888"),
// },
// },
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communications.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// Version: to.Ptr("0.2.0"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithUserAssignedIdentity.json
*/
async function updateResourceToAddAUserAssignedManagedIdentity() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
identity: {
type: "UserAssigned",
userAssignedIdentities: { "/user/assigned/resource/id": {} },
},
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
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 System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithUserAssignedIdentity.json
// this example is just showing the usage of "CommunicationServices_Update" 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 CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Identity = new ManagedServiceIdentity("UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/user/assigned/resource/id")] = new UserAssignedIdentity(),
},
},
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// 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
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"id": "/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource",
"name": "MyCommunicationResource",
"type": "Microsoft.Communication/CommunicationServices",
"location": "Global",
"tags": {
"newTag": "newVal"
},
"properties": {
"provisioningState": "Succeeded",
"dataLocation": "United States",
"hostName": "mycommunicationresource.communications.azure.com",
"version": "0.2.0"
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/user/assigned/resource/id": {
"principalId": "11112222-3333-4444-5555-666677778888",
"clientId": "11112222-3333-4444-5555-666677778888"
}
}
}
}
Update resource to add System and User managed identities
샘플 요청
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
},
"identity": {
"type": "SystemAssigned,UserAssigned",
"userAssignedIdentities": {
"/user/assigned/resource/id": {}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update_with_system_and_user_identity.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 = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={
"identity": {
"type": "SystemAssigned,UserAssigned",
"userAssignedIdentities": {"/user/assigned/resource/id": {}},
},
"tags": {"newTag": "newVal"},
},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAndUserIdentity.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 armcommunication_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/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAndUserIdentity.json
func ExampleServicesClient_Update_updateResourceToAddSystemAndUserManagedIdentities() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
Identity: &armcommunication.ManagedServiceIdentity{
Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssignedUserAssigned),
UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{
"/user/assigned/resource/id": {},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Identity: &armcommunication.ManagedServiceIdentity{
// Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssignedUserAssigned),
// PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"),
// TenantID: to.Ptr("22222222-2222-2222-2222-222222222222"),
// UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{
// "/user/assigned/resource/id": &armcommunication.UserAssignedIdentity{
// ClientID: to.Ptr("11112222-3333-4444-5555-666677778888"),
// PrincipalID: to.Ptr("11112222-3333-4444-5555-666677778888"),
// },
// },
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communications.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// Version: to.Ptr("0.2.0"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAndUserIdentity.json
*/
async function updateResourceToAddSystemAndUserManagedIdentities() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
identity: {
type: "SystemAssigned,UserAssigned",
userAssignedIdentities: { "/user/assigned/resource/id": {} },
},
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
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 System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAndUserIdentity.json
// this example is just showing the usage of "CommunicationServices_Update" 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 CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Identity = new ManagedServiceIdentity("SystemAssigned,UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/user/assigned/resource/id")] = new UserAssignedIdentity(),
},
},
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// 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
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"id": "/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource",
"name": "MyCommunicationResource",
"type": "Microsoft.Communication/CommunicationServices",
"location": "Global",
"tags": {
"newTag": "newVal"
},
"properties": {
"provisioningState": "Succeeded",
"dataLocation": "United States",
"hostName": "mycommunicationresource.communications.azure.com",
"version": "0.2.0"
},
"identity": {
"type": "SystemAssigned,UserAssigned",
"principalId": "11111111-1111-1111-1111-111111111111",
"tenantId": "22222222-2222-2222-2222-222222222222",
"userAssignedIdentities": {
"/user/assigned/resource/id": {
"principalId": "11112222-3333-4444-5555-666677778888",
"clientId": "11112222-3333-4444-5555-666677778888"
}
}
}
}
Update resource to remove identity
샘플 요청
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
},
"identity": {
"type": "None"
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update_remove_system_identity.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 = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={"identity": {"type": "None"}, "tags": {"newTag": "newVal"}},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateRemoveSystemIdentity.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 armcommunication_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/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateRemoveSystemIdentity.json
func ExampleServicesClient_Update_updateResourceToRemoveIdentity() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
Identity: &armcommunication.ManagedServiceIdentity{
Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeNone),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communication.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateRemoveSystemIdentity.json
*/
async function updateResourceToRemoveIdentity() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
identity: { type: "None" },
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
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 System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateRemoveSystemIdentity.json
// this example is just showing the usage of "CommunicationServices_Update" 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 CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Identity = new ManagedServiceIdentity("None"),
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// 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
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"id": "/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource",
"name": "MyCommunicationResource",
"type": "Microsoft.Communication/CommunicationServices",
"location": "Global",
"tags": {
"newTag": "newVal"
},
"properties": {
"provisioningState": "Succeeded",
"dataLocation": "United States",
"hostName": "mycommunicationresource.communication.azure.com"
}
}
정의
CommunicationServiceResource
CommunicationService 리소스를 나타내는 클래스입니다.
Name |
형식 |
Description |
id
|
string
|
리소스에 대한 정규화된 리소스 ID입니다. 예: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
identity
|
ManagedServiceIdentity
|
관리 서비스 ID(시스템 할당 및/또는 사용자 할당 ID)
|
location
|
string
|
리소스가 있는 지리적 위치
|
name
|
string
|
리소스의 이름
|
properties.dataLocation
|
string
|
통신 서비스가 미사용 데이터를 저장하는 위치입니다.
|
properties.hostName
|
string
|
CommunicationService 인스턴스의 FQDN입니다.
|
properties.immutableResourceId
|
string
|
통신 서비스의 변경할 수 없는 리소스 ID입니다.
|
properties.linkedDomains
|
string[]
|
전자 메일 도메인 리소스 ID 목록입니다.
|
properties.notificationHubId
|
string
|
이 리소스에 연결된 Azure Notification Hub의 리소스 ID입니다.
|
properties.provisioningState
|
CommunicationServices_ProvisioningState
|
리소스의 프로비전 상태입니다.
|
properties.version
|
string
|
CommunicationService 리소스의 버전입니다. 클라이언트 SDK의 버전이 동일하거나 더 높은 버전이 필요할 수 있습니다.
|
systemData
|
systemData
|
createdBy 및 modifiedBy 정보가 포함된 Azure Resource Manager 메타데이터입니다.
|
tags
|
object
|
리소스 태그.
|
type
|
string
|
리소스의 형식입니다. 예: "Microsoft.Compute/virtualMachines" 또는 "Microsoft.Storage/storageAccounts"
|
CommunicationServiceResourceUpdate
CommunicationService 리소스에 대한 업데이트 매개 변수를 나타내는 클래스입니다.
Name |
형식 |
Description |
identity
|
ManagedServiceIdentity
|
관리 서비스 ID(시스템 할당 및/또는 사용자 할당 ID)
|
properties.linkedDomains
|
string[]
|
전자 메일 도메인 리소스 ID 목록입니다.
|
tags
|
object
|
리소스를 설명하는 키 값 쌍 목록인 서비스의 태그입니다.
|
CommunicationServices_ProvisioningState
리소스의 프로비전 상태입니다.
Name |
형식 |
Description |
Canceled
|
string
|
|
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Moving
|
string
|
|
Running
|
string
|
|
Succeeded
|
string
|
|
Unknown
|
string
|
|
Updating
|
string
|
|
createdByType
리소스를 만든 ID의 형식입니다.
Name |
형식 |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
리소스 관리 오류 추가 정보입니다.
Name |
형식 |
Description |
info
|
object
|
추가 정보입니다.
|
type
|
string
|
추가 정보 유형입니다.
|
ErrorDetail
오류 세부 정보입니다.
Name |
형식 |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
오류 추가 정보입니다.
|
code
|
string
|
오류 코드입니다.
|
details
|
ErrorDetail[]
|
오류 세부 정보입니다.
|
message
|
string
|
오류 메시지입니다.
|
target
|
string
|
오류 대상입니다.
|
ErrorResponse
오류 응답
ManagedServiceIdentity
관리 서비스 ID(시스템 할당 및/또는 사용자 할당 ID)
Name |
형식 |
Description |
principalId
|
string
|
시스템 할당 ID의 서비스 주체 ID입니다. 이 속성은 시스템 할당 ID에 대해서만 제공됩니다.
|
tenantId
|
string
|
시스템 할당 ID의 테넌트 ID입니다. 이 속성은 시스템 할당 ID에 대해서만 제공됩니다.
|
type
|
ManagedServiceIdentityType
|
관리 서비스 ID의 유형입니다(SystemAssigned 및 UserAssigned 형식이 모두 허용되는 경우).
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
User-Assigned ID
리소스와 연결된 사용자 할당 ID 집합입니다. userAssignedIdentities 사전 키는 '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} 형식의 ARM 리소스 ID입니다. 사전 값은 요청에서 빈 개체({})일 수 있습니다.
|
ManagedServiceIdentityType
관리 서비스 ID의 유형입니다(SystemAssigned 및 UserAssigned 형식이 모두 허용되는 경우).
Name |
형식 |
Description |
None
|
string
|
|
SystemAssigned
|
string
|
|
SystemAssigned,UserAssigned
|
string
|
|
UserAssigned
|
string
|
|
systemData
리소스의 생성 및 마지막 수정과 관련된 메타데이터입니다.
Name |
형식 |
Description |
createdAt
|
string
|
리소스 만들기의 타임스탬프(UTC)입니다.
|
createdBy
|
string
|
리소스를 만든 ID입니다.
|
createdByType
|
createdByType
|
리소스를 만든 ID의 형식입니다.
|
lastModifiedAt
|
string
|
리소스 마지막 수정의 타임스탬프(UTC)
|
lastModifiedBy
|
string
|
리소스를 마지막으로 수정한 ID입니다.
|
lastModifiedByType
|
createdByType
|
리소스를 마지막으로 수정한 ID의 형식입니다.
|
UserAssignedIdentity
사용자 할당 ID 속성
Name |
형식 |
Description |
clientId
|
string
|
할당된 ID의 클라이언트 ID입니다.
|
principalId
|
string
|
할당된 ID의 보안 주체 ID입니다.
|