Operation to update an existing CommunicationService.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}?api-version=2023-04-01
URI Parameters
Name |
In |
Required |
Type |
Description |
communicationServiceName
|
path |
True
|
string
|
The name of the CommunicationService resource.
Regex pattern: ^[-\w]+$
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group. The name is case insensitive.
|
subscriptionId
|
path |
True
|
string
uuid
|
The ID of the target subscription. The value must be an UUID.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
Request Body
Name |
Type |
Description |
identity
|
ManagedServiceIdentity
|
Managed service identity (system assigned and/or user assigned identities)
|
properties.linkedDomains
|
string[]
|
List of email Domain resource Ids.
|
tags
|
object
|
Tags of the service which is a list of key value pairs that describe the resource.
|
Responses
Examples
Update resource
Sample request
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 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();
}
// 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
Sample response
{
"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
Sample request
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 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();
}
// 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
Sample response
{
"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
Sample request
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();
}
// 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
Sample response
{
"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
Sample request
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": {}
}
}
}
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/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_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
Sample response
{
"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
Sample request
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"
}
}
import com.azure.resourcemanager.communication.models.CommunicationServiceResource;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentity;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType;
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/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();
}
// 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_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
Sample response
{
"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"
}
}
Definitions
CommunicationServiceResource
A class representing a CommunicationService resource.
Name |
Type |
Description |
id
|
string
|
Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
identity
|
ManagedServiceIdentity
|
Managed service identity (system assigned and/or user assigned identities)
|
location
|
string
|
The geo-location where the resource lives
|
name
|
string
|
The name of the resource
|
properties.dataLocation
|
string
|
The location where the communication service stores its data at rest.
|
properties.hostName
|
string
|
FQDN of the CommunicationService instance.
|
properties.immutableResourceId
|
string
|
The immutable resource Id of the communication service.
|
properties.linkedDomains
|
string[]
|
List of email Domain resource Ids.
|
properties.notificationHubId
|
string
|
Resource ID of an Azure Notification Hub linked to this resource.
|
properties.provisioningState
|
CommunicationServices_ProvisioningState
|
Provisioning state of the resource.
|
properties.version
|
string
|
Version of the CommunicationService resource. Probably you need the same or higher version of client SDKs.
|
systemData
|
systemData
|
Azure Resource Manager metadata containing createdBy and modifiedBy information.
|
tags
|
object
|
Resource tags.
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
CommunicationServiceResourceUpdate
A class representing update parameters for CommunicationService resource.
Name |
Type |
Description |
identity
|
ManagedServiceIdentity
|
Managed service identity (system assigned and/or user assigned identities)
|
properties.linkedDomains
|
string[]
|
List of email Domain resource Ids.
|
tags
|
object
|
Tags of the service which is a list of key value pairs that describe the resource.
|
CommunicationServices_ProvisioningState
Provisioning state of the resource.
Name |
Type |
Description |
Canceled
|
string
|
|
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Moving
|
string
|
|
Running
|
string
|
|
Succeeded
|
string
|
|
Unknown
|
string
|
|
Updating
|
string
|
|
createdByType
The type of identity that created the resource.
Name |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ErrorResponse
Error response
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
ManagedServiceIdentity
Managed service identity (system assigned and/or user assigned identities)
Name |
Type |
Description |
principalId
|
string
|
The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity.
|
tenantId
|
string
|
The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.
|
type
|
ManagedServiceIdentityType
|
Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
User-Assigned Identities
The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.
|
ManagedServiceIdentityType
Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
Name |
Type |
Description |
None
|
string
|
|
SystemAssigned
|
string
|
|
SystemAssigned,UserAssigned
|
string
|
|
UserAssigned
|
string
|
|
systemData
Metadata pertaining to creation and last modification of the resource.
Name |
Type |
Description |
createdAt
|
string
|
The timestamp of resource creation (UTC).
|
createdBy
|
string
|
The identity that created the resource.
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
lastModifiedAt
|
string
|
The timestamp of resource last modification (UTC)
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|
UserAssignedIdentity
User assigned identity properties
Name |
Type |
Description |
clientId
|
string
|
The client ID of the assigned identity.
|
principalId
|
string
|
The principal ID of the assigned identity.
|