From 8730dd7190daf5db68e36620aa4458b957c2589b Mon Sep 17 00:00:00 2001 From: Joel Eniqs <32092984+Joeleniqs@users.noreply.github.com> Date: Mon, 11 Sep 2023 20:55:53 -0700 Subject: [PATCH] [Communication]Enable managed identity in ACScommunication resource sdk (#37566) * Update autorest mark down to latest OpenApi spec * initial code generation with new Swagger spec hash * remove bugged format and generate code * update spec link to remote link * Adding test scenario for MI * Update Export Api * Update to most recent spec hash * Update Sample Snippets * Add Managed Identity tests session records assets * Re-enforce resourceId format * updated test recording * updated recordings * updated-recordings * fix tests and Update test recordings * Update changelog release history * Provide backward compatibility to accomodate breaking change * remove param from fallback overload * Update customize folder with communication service resource data * fix build issues * fix build issues * export api to support older resource data * fix build issues * Update release date of `1.2.0-beta.2` --------- Co-authored-by: Joel Enikanorogbon Co-authored-by: Jorge Beauregard Co-authored-by: Mingzhe Huang --- .../CHANGELOG.md | 14 +- ...rceManager.Communication.netstandard2.0.cs | 3 + .../assets.json | 2 +- .../Sample_CommunicationDomainResource.cs | 10 +- ...e_CommunicationDomainResourceCollection.cs | 8 +- .../Sample_CommunicationServiceResource.cs | 187 +++++++++++++++++- ..._CommunicationServiceResourceCollection.cs | 49 ++++- .../Samples/Sample_EmailServiceResource.cs | 10 +- .../Sample_EmailServiceResourceCollection.cs | 8 +- .../Samples/Sample_SenderUsernameResource.cs | 6 +- ...Sample_SenderUsernameResourceCollection.cs | 8 +- .../Customize/ArmCommunicationModelFactory.cs | 40 ++++ .../CommunicationServiceResourceData.cs | 43 ++++ .../Generated/ArmCommunicationModelFactory.cs | 5 +- .../CommunicationServiceResourceData.cs | 6 +- ...cationServiceResourceData.Serialization.cs | 19 +- ...ationServiceResourcePatch.Serialization.cs | 7 + .../CommunicationServiceResourcePatch.cs | 3 + .../CommunicationServicesRestOperations.cs | 2 +- .../RestOperations/DomainsRestOperations.cs | 2 +- .../EmailServicesRestOperations.cs | 2 +- .../SenderUsernamesRestOperations.cs | 2 +- .../src/autorest.md | 3 +- .../CommunicationServiceTests.cs | 27 +++ 24 files changed, 408 insertions(+), 58 deletions(-) create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Customize/ArmCommunicationModelFactory.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Customize/CommunicationServiceResourceData.cs diff --git a/sdk/communication/Azure.ResourceManager.Communication/CHANGELOG.md b/sdk/communication/Azure.ResourceManager.Communication/CHANGELOG.md index db4ee60ac203..1a0c9c3eea61 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/CHANGELOG.md +++ b/sdk/communication/Azure.ResourceManager.Communication/CHANGELOG.md @@ -1,14 +1,10 @@ # Release History -## 1.2.0-beta.2 (Unreleased) +## 1.2.0-beta.2 (2023-09-12) ### Features Added -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Added support for System Assigned, User Assigned and SystemAndUserAssigned Managed Identity ## 1.2.0-beta.1 (2023-05-29) @@ -118,7 +114,7 @@ Guidance to migrate from previous version of Azure Management SDK Example: Create A Communication Service Instance: Before upgrade: -```C# +```C# using Azure.Identity; using Azure.ResourceManager.Communication; using Azure.ResourceManager.Communication.Models; @@ -131,7 +127,7 @@ var resourceGroupName = "myResourceGroupName"; var resourceName = "myResource"; var resource = new CommunicationServiceResource { Location = "Global", DataLocation = "UnitedStates" }; var operation = await communicationServiceClient.CommunicationService.StartCreateOrUpdateAsync(resourceGroupName, resourceName, resource); -await operation.WaitForCompletionAsync(); +await operation.WaitForCompletionAsync(); ``` After upgrade: @@ -161,7 +157,7 @@ CommunicationService communicationService = communicationServiceLro.Value; ``` ## 1.0.0 (2021-03-29) -This release is the first stable release of the management library for Azure Communication Services. +This release is the first stable release of the management library for Azure Communication Services. Minor changes since the public preview release: - CheckNameAvailability has been added diff --git a/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs b/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs index f1fa06bfc217..1dfd2fcb0bc4 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs @@ -121,6 +121,7 @@ public partial class CommunicationServiceResourceData : Azure.ResourceManager.Mo public CommunicationServiceResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } public string DataLocation { get { throw null; } set { } } public string HostName { get { throw null; } } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Guid? ImmutableResourceId { get { throw null; } } public System.Collections.Generic.IList LinkedDomains { get { throw null; } } public Azure.Core.ResourceIdentifier NotificationHubId { get { throw null; } } @@ -216,6 +217,7 @@ public static partial class ArmCommunicationModelFactory public static Azure.ResourceManager.Communication.CommunicationDomainResourceData CommunicationDomainResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Communication.Models.DomainProvisioningState? provisioningState = default(Azure.ResourceManager.Communication.Models.DomainProvisioningState?), string dataLocation = null, string fromSenderDomain = null, string mailFromSenderDomain = null, Azure.ResourceManager.Communication.Models.DomainManagement? domainManagement = default(Azure.ResourceManager.Communication.Models.DomainManagement?), Azure.ResourceManager.Communication.Models.DomainPropertiesVerificationStates verificationStates = null, Azure.ResourceManager.Communication.Models.DomainPropertiesVerificationRecords verificationRecords = null, Azure.ResourceManager.Communication.Models.UserEngagementTracking? userEngagementTracking = default(Azure.ResourceManager.Communication.Models.UserEngagementTracking?)) { throw null; } public static Azure.ResourceManager.Communication.Models.CommunicationNameAvailabilityResult CommunicationNameAvailabilityResult(bool? isNameAvailable = default(bool?), Azure.ResourceManager.Communication.Models.CommunicationNameAvailabilityReason? reason = default(Azure.ResourceManager.Communication.Models.CommunicationNameAvailabilityReason?), string message = null) { throw null; } public static Azure.ResourceManager.Communication.Models.CommunicationServiceKeys CommunicationServiceKeys(string primaryKey = null, string secondaryKey = null, string primaryConnectionString = null, string secondaryConnectionString = null) { throw null; } + public static Azure.ResourceManager.Communication.CommunicationServiceResourceData CommunicationServiceResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.Communication.Models.CommunicationServicesProvisioningState? provisioningState = default(Azure.ResourceManager.Communication.Models.CommunicationServicesProvisioningState?), string hostName = null, string dataLocation = null, Azure.Core.ResourceIdentifier notificationHubId = null, string version = null, System.Guid? immutableResourceId = default(System.Guid?), System.Collections.Generic.IEnumerable linkedDomains = null) { throw null; } public static Azure.ResourceManager.Communication.CommunicationServiceResourceData CommunicationServiceResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Communication.Models.CommunicationServicesProvisioningState? provisioningState = default(Azure.ResourceManager.Communication.Models.CommunicationServicesProvisioningState?), string hostName = null, string dataLocation = null, Azure.Core.ResourceIdentifier notificationHubId = null, string version = null, System.Guid? immutableResourceId = default(System.Guid?), System.Collections.Generic.IEnumerable linkedDomains = null) { throw null; } public static Azure.ResourceManager.Communication.Models.DomainPropertiesVerificationRecords DomainPropertiesVerificationRecords(Azure.ResourceManager.Communication.Models.VerificationDnsRecord domain = null, Azure.ResourceManager.Communication.Models.VerificationDnsRecord spf = null, Azure.ResourceManager.Communication.Models.VerificationDnsRecord dkim = null, Azure.ResourceManager.Communication.Models.VerificationDnsRecord dkim2 = null, Azure.ResourceManager.Communication.Models.VerificationDnsRecord dmarc = null) { throw null; } public static Azure.ResourceManager.Communication.Models.DomainPropertiesVerificationStates DomainPropertiesVerificationStates(Azure.ResourceManager.Communication.Models.DomainVerificationStatusRecord domain = null, Azure.ResourceManager.Communication.Models.DomainVerificationStatusRecord spf = null, Azure.ResourceManager.Communication.Models.DomainVerificationStatusRecord dkim = null, Azure.ResourceManager.Communication.Models.DomainVerificationStatusRecord dkim2 = null, Azure.ResourceManager.Communication.Models.DomainVerificationStatusRecord dmarc = null) { throw null; } @@ -311,6 +313,7 @@ public CommunicationServiceNameAvailabilityContent() { } public partial class CommunicationServiceResourcePatch : Azure.ResourceManager.Communication.Models.CommunicationAcceptTags { public CommunicationServiceResourcePatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IList LinkedDomains { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/communication/Azure.ResourceManager.Communication/assets.json b/sdk/communication/Azure.ResourceManager.Communication/assets.json index 22753827e574..73014c588927 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/assets.json +++ b/sdk/communication/Azure.ResourceManager.Communication/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/communication/Azure.ResourceManager.Communication", - "Tag": "net/communication/Azure.ResourceManager.Communication_7b093c3b15" + "Tag": "net/communication/Azure.ResourceManager.Communication_696b7aac1e" } diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResource.cs index 73017847a389..a7fc3b2dca01 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResource.cs @@ -23,7 +23,7 @@ public partial class Sample_CommunicationDomainResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json // this example is just showing the usage of "Domains_Get" 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 @@ -55,7 +55,7 @@ public async Task Get_GetDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/delete.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/delete.json // this example is just showing the usage of "Domains_Delete" 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 @@ -83,7 +83,7 @@ public async Task Delete_DeleteDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/update.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/update.json // this example is just showing the usage of "Domains_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 @@ -120,7 +120,7 @@ public async Task Update_UpdateDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task InitiateVerification_InitiateVerification() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/initiateVerification.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/initiateVerification.json // this example is just showing the usage of "Domains_InitiateVerification" 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 @@ -149,7 +149,7 @@ public async Task InitiateVerification_InitiateVerification() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CancelVerification_CancelVerification() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/cancelVerification.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/cancelVerification.json // this example is just showing the usage of "Domains_CancelVerification" 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 diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs index 11d2f9ff4682..0d2e9969b2ed 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_CommunicationDomainResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json // this example is just showing the usage of "Domains_Get" 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 @@ -58,7 +58,7 @@ public async Task Get_GetDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json // this example is just showing the usage of "Domains_Get" 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 @@ -89,7 +89,7 @@ public async Task Exists_GetDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/createOrUpdate.json // this example is just showing the usage of "Domains_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -129,7 +129,7 @@ public async Task CreateOrUpdate_CreateOrUpdateDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListDomainsResourcesByEmailServiceName() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/listByEmailService.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/listByEmailService.json // this example is just showing the usage of "Domains_ListByEmailServiceResource" 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 diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResource.cs index 52067451d628..c93c8c82b2eb 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResource.cs @@ -13,6 +13,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.Communication; using Azure.ResourceManager.Communication.Models; +using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Communication.Samples @@ -24,7 +25,7 @@ public partial class Sample_CommunicationServiceResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckCommunicationNameAvailability_CheckNameAvailabilityAvailable() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/checkNameAvailabilityAvailable.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/checkNameAvailabilityAvailable.json // this example is just showing the usage of "CommunicationServices_CheckNameAvailability" 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 @@ -54,7 +55,7 @@ public async Task CheckCommunicationNameAvailability_CheckNameAvailabilityAvaila [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckCommunicationNameAvailability_CheckNameAvailabilityUnavailable() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/checkNameAvailabilityUnavailable.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/checkNameAvailabilityUnavailable.json // this example is just showing the usage of "CommunicationServices_CheckNameAvailability" 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 @@ -84,7 +85,7 @@ public async Task CheckCommunicationNameAvailability_CheckNameAvailabilityUnavai [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task LinkNotificationHub_LinkNotificationHub() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/linkNotificationHub.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/linkNotificationHub.json // this example is just showing the usage of "CommunicationServices_LinkNotificationHub" 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 @@ -112,7 +113,7 @@ public async Task LinkNotificationHub_LinkNotificationHub() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetCommunicationServiceResources_ListBySubscription() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/listBySubscription.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listBySubscription.json // this example is just showing the usage of "CommunicationServices_ListBySubscription" 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 @@ -144,7 +145,7 @@ public async Task GetCommunicationServiceResources_ListBySubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/update.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/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 @@ -177,12 +178,180 @@ public async Task Update_UpdateResource() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + // Update resource to add System and User managed identities + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateResourceToAddSystemAndUserManagedIdentities() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/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}"); + } + + // Update resource to add a System Assigned managed identity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateResourceToAddASystemAssignedManagedIdentity() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/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}"); + } + + // Update resource to add a User Assigned managed identity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateResourceToAddAUserAssignedManagedIdentity() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/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}"); + } + + // Update resource to remove identity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateResourceToRemoveIdentity() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/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}"); + } + // Get resource [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json // this example is just showing the usage of "CommunicationServices_Get" 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 @@ -213,7 +382,7 @@ public async Task Get_GetResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/delete.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/delete.json // this example is just showing the usage of "CommunicationServices_Delete" 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 @@ -240,7 +409,7 @@ public async Task Delete_DeleteResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetKeys_ListKeys() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/listKeys.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listKeys.json // this example is just showing the usage of "CommunicationServices_ListKeys" 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 @@ -267,7 +436,7 @@ public async Task GetKeys_ListKeys() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegenerateKey_RegenerateKey() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/regenerateKey.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/regenerateKey.json // this example is just showing the usage of "CommunicationServices_RegenerateKey" 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 diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs index 7a8185280ad5..38503e5e4986 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs @@ -12,6 +12,7 @@ using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.Communication; +using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Communication.Samples @@ -23,7 +24,7 @@ public partial class Sample_CommunicationServiceResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListByResourceGroup() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/listByResourceGroup.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listByResourceGroup.json // this example is just showing the usage of "CommunicationServices_ListByResourceGroup" 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 @@ -59,7 +60,7 @@ public async Task GetAll_ListByResourceGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json // this example is just showing the usage of "CommunicationServices_Get" 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 @@ -93,7 +94,7 @@ public async Task Get_GetResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json // this example is just showing the usage of "CommunicationServices_Get" 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 @@ -123,7 +124,7 @@ public async Task Exists_GetResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdate.json // this example is just showing the usage of "CommunicationServices_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -156,5 +157,45 @@ public async Task CreateOrUpdate_CreateOrUpdateResource() // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + + // Create or update resource with managed identity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateResourceWithManagedIdentity() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdateWithSystemAssignedIdentity.json + // this example is just showing the usage of "CommunicationServices_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "MyResourceGroup"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this CommunicationServiceResource + CommunicationServiceResourceCollection collection = resourceGroupResource.GetCommunicationServiceResources(); + + // invoke the operation + string communicationServiceName = "MyCommunicationResource"; + CommunicationServiceResourceData data = new CommunicationServiceResourceData(new AzureLocation("Global")) + { + Identity = new ManagedServiceIdentity("SystemAssigned"), + DataLocation = "United States", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, communicationServiceName, data); + CommunicationServiceResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CommunicationServiceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResource.cs index 51fb7119c56e..e137b353e40f 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResource.cs @@ -24,7 +24,7 @@ public partial class Sample_EmailServiceResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json // this example is just showing the usage of "EmailServices_Get" 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 @@ -55,7 +55,7 @@ public async Task Get_GetEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/delete.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/delete.json // this example is just showing the usage of "EmailServices_Delete" 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 @@ -82,7 +82,7 @@ public async Task Delete_DeleteEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/update.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/update.json // this example is just showing the usage of "EmailServices_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 @@ -121,7 +121,7 @@ public async Task Update_UpdateEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEmailServiceResources_ListEmailServiceResourcesBySubscription() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/listBySubscription.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/listBySubscription.json // this example is just showing the usage of "EmailServices_ListBySubscription" 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 @@ -153,7 +153,7 @@ public async Task GetEmailServiceResources_ListEmailServiceResourcesBySubscripti [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetVerifiedExchangeOnlineDomainsEmailServices_GetVerifiedExchangeOnlineDomains() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/getVerifiedExchangeOnlineDomains.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/getVerifiedExchangeOnlineDomains.json // this example is just showing the usage of "EmailServices_ListVerifiedExchangeOnlineDomains" 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 diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs index 79f5cf26b712..c3b6f1fd9059 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_EmailServiceResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json // this example is just showing the usage of "EmailServices_Get" 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 @@ -57,7 +57,7 @@ public async Task Get_GetEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json // this example is just showing the usage of "EmailServices_Get" 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 @@ -87,7 +87,7 @@ public async Task Exists_GetEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/createOrUpdate.json // this example is just showing the usage of "EmailServices_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,7 +126,7 @@ public async Task CreateOrUpdate_CreateOrUpdateEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListEmailServiceResourcesByResourceGroup() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/listByResourceGroup.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/listByResourceGroup.json // this example is just showing the usage of "EmailServices_ListByResourceGroup" 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 diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResource.cs index 4e6555545056..95647f9bd151 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResource.cs @@ -22,7 +22,7 @@ public partial class Sample_SenderUsernameResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json // this example is just showing the usage of "SenderUsernames_Get" 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 @@ -55,7 +55,7 @@ public async Task Get_GetSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateOrUpdateSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/createOrUpdate.json // this example is just showing the usage of "SenderUsernames_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -94,7 +94,7 @@ public async Task Update_CreateOrUpdateSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/delete.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/delete.json // this example is just showing the usage of "SenderUsernames_Delete" 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 diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs index 5e3dc66ac777..646ceb10fb40 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_SenderUsernameResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/listByDomain.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/listByDomain.json // this example is just showing the usage of "SenderUsernames_ListByDomains" 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 @@ -60,7 +60,7 @@ public async Task GetAll_GetSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json // this example is just showing the usage of "SenderUsernames_Get" 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 @@ -96,7 +96,7 @@ public async Task Get_GetSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json // this example is just showing the usage of "SenderUsernames_Get" 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 @@ -128,7 +128,7 @@ public async Task Exists_GetSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/createOrUpdate.json // this example is just showing the usage of "SenderUsernames_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Customize/ArmCommunicationModelFactory.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Customize/ArmCommunicationModelFactory.cs new file mode 100644 index 000000000000..e507d0fbc55a --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Customize/ArmCommunicationModelFactory.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Communication.Models +{ + /// Model factory for models. + public static partial class ArmCommunicationModelFactory + { + /// Initializes a new instance of CommunicationServiceResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Provisioning state of the resource. + /// FQDN of the CommunicationService instance. + /// The location where the communication service stores its data at rest. + /// Resource ID of an Azure Notification Hub linked to this resource. + /// Version of the CommunicationService resource. Probably you need the same or higher version of client SDKs. + /// The immutable resource Id of the communication service. + /// List of email Domain resource Ids. + /// A new instance for mocking. + public static CommunicationServiceResourceData CommunicationServiceResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, Azure.ResourceManager.Models.SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CommunicationServicesProvisioningState? provisioningState = null, string hostName = null, string dataLocation = null, ResourceIdentifier notificationHubId = null, string version = null, Guid? immutableResourceId = null, IEnumerable linkedDomains = null) + { + tags ??= new Dictionary(); + linkedDomains ??= new List(); + + return new CommunicationServiceResourceData(id, name, resourceType, systemData, tags, location, provisioningState, hostName, dataLocation, notificationHubId, version, immutableResourceId, linkedDomains?.ToList()); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Customize/CommunicationServiceResourceData.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Customize/CommunicationServiceResourceData.cs new file mode 100644 index 000000000000..99ddaa63b3f0 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Customize/CommunicationServiceResourceData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Communication.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Communication +{ + /// + /// A class representing the CommunicationServiceResource data model. + /// A class representing a CommunicationService resource. + /// + public partial class CommunicationServiceResourceData : TrackedResourceData + { + /// Initializes a new instance of CommunicationServiceResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Provisioning state of the resource. + /// FQDN of the CommunicationService instance. + /// The location where the communication service stores its data at rest. + /// Resource ID of an Azure Notification Hub linked to this resource. + /// Version of the CommunicationService resource. Probably you need the same or higher version of client SDKs. + /// The immutable resource Id of the communication service. + /// List of email Domain resource Ids. + internal CommunicationServiceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, IDictionary tags, AzureLocation location, CommunicationServicesProvisioningState? provisioningState, string hostName, string dataLocation, ResourceIdentifier notificationHubId, string version, Guid? immutableResourceId, IList linkedDomains) : base(id, name, resourceType, systemData, tags, location) + { + ProvisioningState = provisioningState; + HostName = hostName; + DataLocation = dataLocation; + NotificationHubId = notificationHubId; + Version = version; + ImmutableResourceId = immutableResourceId; + LinkedDomains = linkedDomains; + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs index 790a2a160020..ba6b9309c751 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs @@ -42,6 +42,7 @@ public static LinkedNotificationHub LinkedNotificationHub(ResourceIdentifier res /// The systemData. /// The tags. /// The location. + /// Managed service identity (system assigned and/or user assigned identities). /// Provisioning state of the resource. /// FQDN of the CommunicationService instance. /// The location where the communication service stores its data at rest. @@ -50,12 +51,12 @@ public static LinkedNotificationHub LinkedNotificationHub(ResourceIdentifier res /// The immutable resource Id of the communication service. /// List of email Domain resource Ids. /// A new instance for mocking. - public static CommunicationServiceResourceData CommunicationServiceResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, CommunicationServicesProvisioningState? provisioningState = null, string hostName = null, string dataLocation = null, ResourceIdentifier notificationHubId = null, string version = null, Guid? immutableResourceId = null, IEnumerable linkedDomains = null) + public static CommunicationServiceResourceData CommunicationServiceResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, CommunicationServicesProvisioningState? provisioningState = null, string hostName = null, string dataLocation = null, ResourceIdentifier notificationHubId = null, string version = null, Guid? immutableResourceId = null, IEnumerable linkedDomains = null) { tags ??= new Dictionary(); linkedDomains ??= new List(); - return new CommunicationServiceResourceData(id, name, resourceType, systemData, tags, location, provisioningState, hostName, dataLocation, notificationHubId, version, immutableResourceId, linkedDomains?.ToList()); + return new CommunicationServiceResourceData(id, name, resourceType, systemData, tags, location, identity, provisioningState, hostName, dataLocation, notificationHubId, version, immutableResourceId, linkedDomains?.ToList()); } /// Initializes a new instance of CommunicationServiceKeys. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceData.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceData.cs index 752a80fd7ea2..df41749843d2 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceData.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationServiceResourceData.cs @@ -33,6 +33,7 @@ public CommunicationServiceResourceData(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. + /// Managed service identity (system assigned and/or user assigned identities). /// Provisioning state of the resource. /// FQDN of the CommunicationService instance. /// The location where the communication service stores its data at rest. @@ -40,8 +41,9 @@ public CommunicationServiceResourceData(AzureLocation location) : base(location) /// Version of the CommunicationService resource. Probably you need the same or higher version of client SDKs. /// The immutable resource Id of the communication service. /// List of email Domain resource Ids. - internal CommunicationServiceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, CommunicationServicesProvisioningState? provisioningState, string hostName, string dataLocation, ResourceIdentifier notificationHubId, string version, Guid? immutableResourceId, IList linkedDomains) : base(id, name, resourceType, systemData, tags, location) + internal CommunicationServiceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, CommunicationServicesProvisioningState? provisioningState, string hostName, string dataLocation, ResourceIdentifier notificationHubId, string version, Guid? immutableResourceId, IList linkedDomains) : base(id, name, resourceType, systemData, tags, location) { + Identity = identity; ProvisioningState = provisioningState; HostName = hostName; DataLocation = dataLocation; @@ -51,6 +53,8 @@ internal CommunicationServiceResourceData(ResourceIdentifier id, string name, Re LinkedDomains = linkedDomains; } + /// Managed service identity (system assigned and/or user assigned identities). + public ManagedServiceIdentity Identity { get; set; } /// Provisioning state of the resource. public CommunicationServicesProvisioningState? ProvisioningState { get; } /// FQDN of the CommunicationService instance. diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceData.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceData.Serialization.cs index 7f1efde6d685..4c4316dc5314 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceData.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourceData.Serialization.cs @@ -19,6 +19,12 @@ public partial class CommunicationServiceResourceData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -59,6 +65,7 @@ internal static CommunicationServiceResourceData DeserializeCommunicationService { return null; } + Optional identity = default; Optional> tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -74,6 +81,16 @@ internal static CommunicationServiceResourceData DeserializeCommunicationService Optional> linkedDomains = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -186,7 +203,7 @@ internal static CommunicationServiceResourceData DeserializeCommunicationService continue; } } - return new CommunicationServiceResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), hostName.Value, dataLocation.Value, notificationHubId.Value, version.Value, Optional.ToNullable(immutableResourceId), Optional.ToList(linkedDomains)); + return new CommunicationServiceResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, identity, Optional.ToNullable(provisioningState), hostName.Value, dataLocation.Value, notificationHubId.Value, version.Value, Optional.ToNullable(immutableResourceId), Optional.ToList(linkedDomains)); } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.Serialization.cs index 6a191267a994..6f7800baa37d 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.Serialization.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Communication.Models { @@ -15,6 +16,12 @@ public partial class CommunicationServiceResourcePatch : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.cs index b1f1657a6da4..5e7c3757b444 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/CommunicationServiceResourcePatch.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Communication.Models { @@ -19,6 +20,8 @@ public CommunicationServiceResourcePatch() LinkedDomains = new ChangeTrackingList(); } + /// Managed service identity (system assigned and/or user assigned identities). + public ManagedServiceIdentity Identity { get; set; } /// List of email Domain resource Ids. public IList LinkedDomains { get; } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs index 3e7ccde21997..f43aeec376af 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs @@ -33,7 +33,7 @@ public CommunicationServicesRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-31"; + _apiVersion = apiVersion ?? "2023-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs index cca2058e6d5e..8121b7511752 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs @@ -33,7 +33,7 @@ public DomainsRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-31"; + _apiVersion = apiVersion ?? "2023-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs index 35fe8414d47a..8a123c692ec3 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs @@ -34,7 +34,7 @@ public EmailServicesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-31"; + _apiVersion = apiVersion ?? "2023-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs index 9914a7d7b5cd..7de90a78d3f7 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs @@ -33,7 +33,7 @@ public SenderUsernamesRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-31"; + _apiVersion = apiVersion ?? "2023-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md b/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md index 13d245acd9bd..6dba6fb0a221 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md +++ b/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true title: communication namespace: Azure.ResourceManager.Communication # default tag is a preview version -require: https://github.com/Azure/azure-rest-api-specs/blob/bbee55edb05169aba6d8d1944c0e2bc2b9408943/specification/communication/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/d71132a3e8bf8ad22ab77991805e033ed1b66dff/specification/communication/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: @@ -80,5 +80,4 @@ directive: where: $.parameters.SubscriptionIdParameter transform: > delete $["format"]; - ``` diff --git a/sdk/communication/Azure.ResourceManager.Communication/tests/ScenarioTests/CommunicationServiceTests.cs b/sdk/communication/Azure.ResourceManager.Communication/tests/ScenarioTests/CommunicationServiceTests.cs index 59891b0ddd46..d72b071ee100 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/tests/ScenarioTests/CommunicationServiceTests.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/tests/ScenarioTests/CommunicationServiceTests.cs @@ -8,6 +8,7 @@ using Azure.Core; using Azure.Core.TestFramework; using Azure.ResourceManager.Communication.Models; +using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources; using NUnit.Framework; @@ -52,6 +53,15 @@ public async Task TearDown() } } + private async Task CreateUserAssignedIdentityAsync() + { + string userAssignedIdentityName = Recording.GenerateAssetName("testMsi-"); + ResourceIdentifier userIdentityId = new ResourceIdentifier($"{_resourceGroup.Id}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}"); + var input = new GenericResourceData("westus2"); + var response = await ArmClient.GetGenericResources().CreateOrUpdateAsync(WaitUntil.Completed, userIdentityId, input); + return response.Value; + } + [TestCase(null)] [TestCase(true)] [TestCase(false)] @@ -111,6 +121,23 @@ public async Task SetTags(bool? useTagResource) Assert.AreEqual(tagValue.Value, "newtestvalue"); } + [Test] + public async Task CreateResourceWithManagedIdentity() + { + var identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssignedUserAssigned); + var userAssignedIdentity = await CreateUserAssignedIdentityAsync(); + identity.UserAssignedIdentities.Add(userAssignedIdentity.Id, new UserAssignedIdentity()); + CommunicationServiceResourceData data = new CommunicationServiceResourceData(ResourceLocation) + { + DataLocation = ResourceDataLocation, + Identity = identity + }; + string communicationServiceName = Recording.GenerateAssetName("communication-service-"); + var communicationServiceLro = await _resourceGroup.GetCommunicationServiceResources().CreateOrUpdateAsync(WaitUntil.Completed, communicationServiceName, data); + var resource = communicationServiceLro.Value; + Assert.AreEqual(resource.Data.Identity.ManagedServiceIdentityType, ManagedServiceIdentityType.SystemAssignedUserAssigned); + } + [Test] public async Task GetKeys() {