Operacja aktualizowania istniejącej usługi CommunicationService.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}?api-version=2023-04-01
Parametry identyfikatora URI
Nazwa |
W |
Wymagane |
Typ |
Opis |
communicationServiceName
|
path |
True
|
string
|
Nazwa zasobu CommunicationService.
Wzorzec wyrażenia regularnego: ^[-\w]+$
|
resourceGroupName
|
path |
True
|
string
|
Nazwa grupy zasobów. Nazwa jest niewrażliwa na wielkość liter.
|
subscriptionId
|
path |
True
|
string
uuid
|
Identyfikator subskrypcji docelowej. Wartość musi być identyfikatorem UUID.
|
api-version
|
query |
True
|
string
|
Wersja interfejsu API do użycia dla tej operacji.
|
Treść żądania
Nazwa |
Typ |
Opis |
identity
|
ManagedServiceIdentity
|
Tożsamość usługi zarządzanej (tożsamości przypisane przez system i/lub tożsamości przypisane przez użytkownika)
|
properties.linkedDomains
|
string[]
|
Lista identyfikatorów zasobów domeny poczty e-mail.
|
tags
|
object
|
Tagi usługi, która jest listą par klucz-wartość, które opisują zasób.
|
Odpowiedzi
Przykłady
Update resource
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
}
}
import com.azure.resourcemanager.communication.models.CommunicationServiceResource;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentity;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType;
import com.azure.resourcemanager.communication.models.UserAssignedIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for CommunicationServices Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/update.json
*/
/**
* Sample code: Update resource.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResource(com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal")).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateRemoveSystemIdentity.json
*/
/**
* Sample code: Update resource to remove identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void
updateResourceToRemoveIdentity(com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithSystemAndUserIdentity.json
*/
/**
* Sample code: Update resource to add System and User managed identities.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddSystemAndUserManagedIdentities(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(
new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)
.withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity())))
.apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={"tags": {"newTag": "newVal"}},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/update.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcommunication_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/update.json
func ExampleServicesClient_Update_updateResource() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Identity: &armcommunication.ManagedServiceIdentity{
// Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeNone),
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communications.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// Version: to.Ptr("0.2.0"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/update.json
*/
async function updateResource() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/update.json
// this example is just showing the usage of "CommunicationServices_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
},
"identity": {
"type": "SystemAssigned"
}
}
import com.azure.resourcemanager.communication.models.CommunicationServiceResource;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentity;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType;
import com.azure.resourcemanager.communication.models.UserAssignedIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for CommunicationServices Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithSystemAssignedIdentity.json
*/
/**
* Sample code: Update resource to add a System Assigned managed identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddASystemAssignedManagedIdentity(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateRemoveSystemIdentity.json
*/
/**
* Sample code: Update resource to remove identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void
updateResourceToRemoveIdentity(com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithSystemAndUserIdentity.json
*/
/**
* Sample code: Update resource to add System and User managed identities.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddSystemAndUserManagedIdentities(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(
new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)
.withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity())))
.apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update_with_system_assigned_identity.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={"identity": {"type": "SystemAssigned"}, "tags": {"newTag": "newVal"}},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAssignedIdentity.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcommunication_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAssignedIdentity.json
func ExampleServicesClient_Update_updateResourceToAddASystemAssignedManagedIdentity() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
Identity: &armcommunication.ManagedServiceIdentity{
Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssigned),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Identity: &armcommunication.ManagedServiceIdentity{
// Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"),
// TenantID: to.Ptr("22222222-2222-2222-2222-222222222222"),
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communications.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// Version: to.Ptr("0.2.0"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAssignedIdentity.json
*/
async function updateResourceToAddASystemAssignedManagedIdentity() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
identity: { type: "SystemAssigned" },
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAssignedIdentity.json
// this example is just showing the usage of "CommunicationServices_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Identity = new ManagedServiceIdentity("SystemAssigned"),
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/user/assigned/resource/id": {}
}
}
}
import com.azure.resourcemanager.communication.models.CommunicationServiceResource;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentity;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType;
import com.azure.resourcemanager.communication.models.UserAssignedIdentity;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for CommunicationServices Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithUserAssignedIdentity.json
*/
/**
* Sample code: Update resource to add a User Assigned managed identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddAUserAssignedManagedIdentity(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity())))
.apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateRemoveSystemIdentity.json
*/
/**
* Sample code: Update resource to remove identity.
*
* @param manager Entry point to CommunicationManager.
*/
public static void
updateResourceToRemoveIdentity(com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)).apply();
}
/*
* x-ms-original-file:
* specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/
* communicationServices/updateWithSystemAndUserIdentity.json
*/
/**
* Sample code: Update resource to add System and User managed identities.
*
* @param manager Entry point to CommunicationManager.
*/
public static void updateResourceToAddSystemAndUserManagedIdentities(
com.azure.resourcemanager.communication.CommunicationManager manager) {
CommunicationServiceResource resource
= manager.communicationServices().getByResourceGroupWithResponse("MyResourceGroup",
"MyCommunicationResource", com.azure.core.util.Context.NONE).getValue();
resource.update().withTags(mapOf("newTag", "newVal"))
.withIdentity(
new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)
.withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity())))
.apply();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update_with_user_assigned_identity.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={
"identity": {"type": "UserAssigned", "userAssignedIdentities": {"/user/assigned/resource/id": {}}},
"tags": {"newTag": "newVal"},
},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithUserAssignedIdentity.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcommunication_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithUserAssignedIdentity.json
func ExampleServicesClient_Update_updateResourceToAddAUserAssignedManagedIdentity() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
Identity: &armcommunication.ManagedServiceIdentity{
Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{
"/user/assigned/resource/id": {},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Identity: &armcommunication.ManagedServiceIdentity{
// Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{
// "/user/assigned/resource/id": &armcommunication.UserAssignedIdentity{
// ClientID: to.Ptr("11112222-3333-4444-5555-666677778888"),
// PrincipalID: to.Ptr("11112222-3333-4444-5555-666677778888"),
// },
// },
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communications.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// Version: to.Ptr("0.2.0"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithUserAssignedIdentity.json
*/
async function updateResourceToAddAUserAssignedManagedIdentity() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
identity: {
type: "UserAssigned",
userAssignedIdentities: { "/user/assigned/resource/id": {} },
},
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithUserAssignedIdentity.json
// this example is just showing the usage of "CommunicationServices_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Identity = new ManagedServiceIdentity("UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/user/assigned/resource/id")] = new UserAssignedIdentity(),
},
},
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
},
"identity": {
"type": "SystemAssigned,UserAssigned",
"userAssignedIdentities": {
"/user/assigned/resource/id": {}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update_with_system_and_user_identity.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={
"identity": {
"type": "SystemAssigned,UserAssigned",
"userAssignedIdentities": {"/user/assigned/resource/id": {}},
},
"tags": {"newTag": "newVal"},
},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAndUserIdentity.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcommunication_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAndUserIdentity.json
func ExampleServicesClient_Update_updateResourceToAddSystemAndUserManagedIdentities() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
Identity: &armcommunication.ManagedServiceIdentity{
Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssignedUserAssigned),
UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{
"/user/assigned/resource/id": {},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Identity: &armcommunication.ManagedServiceIdentity{
// Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssignedUserAssigned),
// PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"),
// TenantID: to.Ptr("22222222-2222-2222-2222-222222222222"),
// UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{
// "/user/assigned/resource/id": &armcommunication.UserAssignedIdentity{
// ClientID: to.Ptr("11112222-3333-4444-5555-666677778888"),
// PrincipalID: to.Ptr("11112222-3333-4444-5555-666677778888"),
// },
// },
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communications.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// Version: to.Ptr("0.2.0"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAndUserIdentity.json
*/
async function updateResourceToAddSystemAndUserManagedIdentities() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
identity: {
type: "SystemAssigned,UserAssigned",
userAssignedIdentities: { "/user/assigned/resource/id": {} },
},
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAndUserIdentity.json
// this example is just showing the usage of "CommunicationServices_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Identity = new ManagedServiceIdentity("SystemAssigned,UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/user/assigned/resource/id")] = new UserAssignedIdentity(),
},
},
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
PATCH https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource?api-version=2023-04-01
{
"tags": {
"newTag": "newVal"
},
"identity": {
"type": "None"
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.communication import CommunicationServiceManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-communication
# USAGE
python update_remove_system_identity.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CommunicationServiceManagementClient(
credential=DefaultAzureCredential(),
subscription_id="11112222-3333-4444-5555-666677778888",
)
response = client.communication_services.update(
resource_group_name="MyResourceGroup",
communication_service_name="MyCommunicationResource",
parameters={"identity": {"type": "None"}, "tags": {"newTag": "newVal"}},
)
print(response)
# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateRemoveSystemIdentity.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcommunication_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateRemoveSystemIdentity.json
func ExampleServicesClient_Update_updateResourceToRemoveIdentity() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcommunication.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{
Tags: map[string]*string{
"newTag": to.Ptr("newVal"),
},
Identity: &armcommunication.ManagedServiceIdentity{
Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeNone),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ServiceResource = armcommunication.ServiceResource{
// Name: to.Ptr("MyCommunicationResource"),
// Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
// ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"),
// Location: to.Ptr("Global"),
// Tags: map[string]*string{
// "newTag": to.Ptr("newVal"),
// },
// Properties: &armcommunication.ServiceProperties{
// DataLocation: to.Ptr("United States"),
// HostName: to.Ptr("mycommunicationresource.communication.azure.com"),
// ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Operation to update an existing CommunicationService.
*
* @summary Operation to update an existing CommunicationService.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateRemoveSystemIdentity.json
*/
async function updateResourceToRemoveIdentity() {
const subscriptionId =
process.env["COMMUNICATION_SUBSCRIPTION_ID"] || "11112222-3333-4444-5555-666677778888";
const resourceGroupName = process.env["COMMUNICATION_RESOURCE_GROUP"] || "MyResourceGroup";
const communicationServiceName = "MyCommunicationResource";
const parameters = {
identity: { type: "None" },
tags: { newTag: "newVal" },
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationServices.update(
resourceGroupName,
communicationServiceName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Communication.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateRemoveSystemIdentity.json
// this example is just showing the usage of "CommunicationServices_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this CommunicationServiceResource created on azure
// for more information of creating CommunicationServiceResource, please refer to the document of CommunicationServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string communicationServiceName = "MyCommunicationResource";
ResourceIdentifier communicationServiceResourceId = CommunicationServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, communicationServiceName);
CommunicationServiceResource communicationServiceResource = client.GetCommunicationServiceResource(communicationServiceResourceId);
// invoke the operation
CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch()
{
Identity = new ManagedServiceIdentity("None"),
Tags =
{
["newTag"] = "newVal",
},
};
CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch);
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
CommunicationServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Przykładowa odpowiedź
{
"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"
}
}
Definicje
CommunicationServiceResource
Klasa reprezentująca zasób CommunicationService.
Nazwa |
Typ |
Opis |
id
|
string
|
W pełni kwalifikowany identyfikator zasobu dla zasobu. Np. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
identity
|
ManagedServiceIdentity
|
Tożsamość usługi zarządzanej (tożsamości przypisane przez system i/lub tożsamości przypisane przez użytkownika)
|
location
|
string
|
Lokalizacja geograficzna, w której znajduje się zasób
|
name
|
string
|
Nazwa zasobu
|
properties.dataLocation
|
string
|
Lokalizacja, w której usługa komunikacji przechowuje dane magazynowane.
|
properties.hostName
|
string
|
Nazwa FQDN wystąpienia usługi CommunicationService.
|
properties.immutableResourceId
|
string
|
Niezmienny identyfikator zasobu usługi komunikacyjnej.
|
properties.linkedDomains
|
string[]
|
Lista identyfikatorów zasobów domeny poczty e-mail.
|
properties.notificationHubId
|
string
|
Identyfikator zasobu usługi Azure Notification Hub połączony z tym zasobem.
|
properties.provisioningState
|
CommunicationServices_ProvisioningState
|
Stan aprowizacji zasobu.
|
properties.version
|
string
|
Wersja zasobu CommunicationService. Prawdopodobnie potrzebujesz tej samej lub nowszej wersji zestawów SDK klienta.
|
systemData
|
systemData
|
Metadane usługi Azure Resource Manager zawierające informacje createdBy i modifiedBy.
|
tags
|
object
|
Tagi zasobów.
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
CommunicationServiceResourceUpdate
Klasa reprezentująca parametry aktualizacji zasobu CommunicationService.
Nazwa |
Typ |
Opis |
identity
|
ManagedServiceIdentity
|
Tożsamość usługi zarządzanej (tożsamości przypisane przez system i/lub tożsamości przypisane przez użytkownika)
|
properties.linkedDomains
|
string[]
|
Lista identyfikatorów zasobów domeny poczty e-mail.
|
tags
|
object
|
Tagi usługi, która jest listą par klucz-wartość, które opisują zasób.
|
CommunicationServices_ProvisioningState
Stan aprowizacji zasobu.
Nazwa |
Typ |
Opis |
Canceled
|
string
|
|
Creating
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
Moving
|
string
|
|
Running
|
string
|
|
Succeeded
|
string
|
|
Unknown
|
string
|
|
Updating
|
string
|
|
createdByType
Typ tożsamości, która utworzyła zasób.
Nazwa |
Typ |
Opis |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
Dodatkowe informacje o błędzie zarządzania zasobami.
Nazwa |
Typ |
Opis |
info
|
object
|
Dodatkowe informacje.
|
type
|
string
|
Dodatkowy typ informacji.
|
ErrorDetail
Szczegóły błędu.
Nazwa |
Typ |
Opis |
additionalInfo
|
ErrorAdditionalInfo[]
|
Dodatkowe informacje o błędzie.
|
code
|
string
|
Kod błędu.
|
details
|
ErrorDetail[]
|
Szczegóły błędu.
|
message
|
string
|
Komunikat o błędzie.
|
target
|
string
|
Element docelowy błędu.
|
ErrorResponse
Odpowiedź na błąd
ManagedServiceIdentity
Tożsamość usługi zarządzanej (tożsamości przypisane przez system i/lub tożsamości przypisane przez użytkownika)
Nazwa |
Typ |
Opis |
principalId
|
string
|
Identyfikator jednostki usługi tożsamości przypisanej przez system. Ta właściwość zostanie udostępniona tylko dla tożsamości przypisanej przez system.
|
tenantId
|
string
|
Identyfikator dzierżawy tożsamości przypisanej przez system. Ta właściwość zostanie udostępniona tylko dla tożsamości przypisanej przez system.
|
type
|
ManagedServiceIdentityType
|
Typ tożsamości usługi zarządzanej (gdzie dozwolone są typy SystemAssigned i UserAssigned).
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
tożsamości User-Assigned
Zestaw tożsamości przypisanych przez użytkownika skojarzonych z zasobem. Klucze słownika userAssignedIdentities będą identyfikatorami zasobów usługi ARM w postaci: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. Wartości słownika mogą być pustymi obiektami ({}) w żądaniach.
|
ManagedServiceIdentityType
Typ tożsamości usługi zarządzanej (gdzie dozwolone są typy SystemAssigned i UserAssigned).
Nazwa |
Typ |
Opis |
None
|
string
|
|
SystemAssigned
|
string
|
|
SystemAssigned,UserAssigned
|
string
|
|
UserAssigned
|
string
|
|
systemData
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
Nazwa |
Typ |
Opis |
createdAt
|
string
|
Sygnatura czasowa tworzenia zasobu (UTC).
|
createdBy
|
string
|
Tożsamość, która utworzyła zasób.
|
createdByType
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
lastModifiedAt
|
string
|
Znacznik czasu ostatniej modyfikacji zasobu (UTC)
|
lastModifiedBy
|
string
|
Tożsamość, która ostatnio zmodyfikowała zasób.
|
lastModifiedByType
|
createdByType
|
Typ tożsamości, która ostatnio zmodyfikowała zasób.
|
UserAssignedIdentity
Właściwości tożsamości przypisanej przez użytkownika
Nazwa |
Typ |
Opis |
clientId
|
string
|
Identyfikator klienta przypisanej tożsamości.
|
principalId
|
string
|
Identyfikator podmiotu zabezpieczeń przypisanej tożsamości.
|