https://pulumi.com logo
#azure
Title
# azure
l

little-library-54601

07/13/2023, 2:05 PM
Can anyone point me to examples of creating an Azure Communications Services resource that's more detailed than the API docs: https://www.pulumi.com/registry/packages/azure-native/api-docs/communication/communicationservice/ As I look at the "export template" in the Azure Portal as well as some of the quick starts, it may be that there's not much more exposed for programmatic access to that type of resource. It looks like you cannot purchase a phone number programmatically. But if there's anything else I can / should do in creating one via Pulumi, I'd appreciate the pointers. Thanks.
I did find this, which seems like it will help with retrieving the keys for an Azure Communications Services resource: https://www.pulumi.com/registry/packages/azure-native/api-docs/communication/listcommunicationservicekeys/
This C# code seems to have worked.
Copy code
private static Output<string> InitializeCommunicationsServices(Output<string> rgSharedName)
{
	var communicationService = new CommunicationService("commsvcs-shared", new CommunicationServiceArgs
	{
		CommunicationServiceName = "commsvcs-shared",
		DataLocation = "United States",
		Location = "global",
		ResourceGroupName = rgSharedName,
	});

	var keysResult = ListCommunicationServiceKeys.Invoke(new ListCommunicationServiceKeysInvokeArgs
	{
		CommunicationServiceName = communicationService.Name,
		ResourceGroupName = rgSharedName
	});

	return keysResult.Apply(k => k.PrimaryConnectionString)!;
}
I haven't gotten as far as using the
Azure.Communications.Sms
nuget package to interact with the service yet, but what I see in the Azure portal looks good.
One more thing, again, in case anyone ever follows along or cares... Creating the Azure Communications Services resource via Pulumi took 97 seconds. Slowest resource creation I've yet encountered.
2 Views