既存の CommunicationService を更新する操作。
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}?api-version=2023-04-01
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
communicationServiceName
|
path |
True
|
string
|
CommunicationService リソースの名前。
正規表現パターン: ^[-\w]+$
|
resourceGroupName
|
path |
True
|
string
|
リソース グループの名前。 名前では大文字と小文字が区別されません。
|
subscriptionId
|
path |
True
|
string
uuid
|
ターゲット サブスクリプションの ID。 値は UUID である必要があります。
|
api-version
|
query |
True
|
string
|
この操作に使用する API バージョン。
|
要求本文
名前 |
型 |
説明 |
identity
|
ManagedServiceIdentity
|
マネージド サービス ID (システム割り当て 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 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
応答のサンプル
{
"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 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
応答のサンプル
{
"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();
}
// 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": {}
}
}
}
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
応答のサンプル
{
"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"
}
}
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
応答のサンプル
{
"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 リソースを表すクラス。
名前 |
型 |
説明 |
id
|
string
|
リソースの完全修飾リソース ID。 例: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
identity
|
ManagedServiceIdentity
|
マネージド サービス ID (システム割り当て 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 リソースの更新パラメーターを表すクラス。
名前 |
型 |
説明 |
identity
|
ManagedServiceIdentity
|
マネージド サービス ID (システム割り当て ID またはユーザー割り当て ID)
|
properties.linkedDomains
|
string[]
|
電子メール ドメイン リソース ID の一覧。
|
tags
|
object
|
リソースを記述するキー値ペアの一覧であるサービスのタグ。
|
CommunicationServices_ProvisioningState
リソースのプロビジョニング状態。
名前 |
型 |
説明 |
Canceled
|
string
|
|
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Moving
|
string
|
|
Running
|
string
|
|
Succeeded
|
string
|
|
Unknown
|
string
|
|
Updating
|
string
|
|
createdByType
リソースを作成した ID の種類。
名前 |
型 |
説明 |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
リソース管理エラーの追加情報。
名前 |
型 |
説明 |
info
|
object
|
追加情報。
|
type
|
string
|
追加情報の種類。
|
ErrorDetail
エラーの詳細。
名前 |
型 |
説明 |
additionalInfo
|
ErrorAdditionalInfo[]
|
エラーの追加情報。
|
code
|
string
|
エラー コード。
|
details
|
ErrorDetail[]
|
エラーの詳細。
|
message
|
string
|
エラー メッセージ。
|
target
|
string
|
エラーターゲット。
|
ErrorResponse
エラー応答
ManagedServiceIdentity
マネージド サービス ID (システム割り当て ID またはユーザー割り当て ID)
名前 |
型 |
説明 |
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 型の両方が許可されます)。
名前 |
型 |
説明 |
None
|
string
|
|
SystemAssigned
|
string
|
|
SystemAssigned,UserAssigned
|
string
|
|
UserAssigned
|
string
|
|
systemData
リソースの作成と最後の変更に関連するメタデータ。
名前 |
型 |
説明 |
createdAt
|
string
|
リソース作成のタイムスタンプ (UTC)。
|
createdBy
|
string
|
リソースを作成した ID。
|
createdByType
|
createdByType
|
リソースを作成した ID の種類。
|
lastModifiedAt
|
string
|
リソースの最終変更のタイムスタンプ (UTC)
|
lastModifiedBy
|
string
|
リソースを最後に変更した ID。
|
lastModifiedByType
|
createdByType
|
リソースを最後に変更した ID の種類。
|
UserAssignedIdentity
ユーザー割り当て ID プロパティ
名前 |
型 |
説明 |
clientId
|
string
|
割り当てられた ID のクライアント ID。
|
principalId
|
string
|
割り当てられた ID のプリンシパル ID。
|