Set up SMS and voice with your own telephony provider using APIs (BYOT) in Microsoft Entra ID
On this page
Bring your own telephony provider to Microsoft Entra ID#
In my previous post, I set up SMS and voice authentication with Soprano through Choose Your Own Telephony Provider (CYOT). That meant buying a provider offer through the Microsoft Security Store and following the setup in the Entra admin center.
This time, let’s look at Bring Your Own Telephony Provider (BYOT). The idea is similar, but the purchasing and configuration are different: you have a direct agreement with your provider, deploy an integration in your Azure subscription, and configure the authentication method policy using Microsoft Graph. There is no Microsoft Security Store purchase in this flow.
For my demo, I am using Smstools, a provider based in Belgium, Europe. You can buy a subscription directly or use an existing account, create API credentials, and connect them to the integration. I’m using my fork of the external phone provider sample, which includes a Smstools adapter.
Microsoft Entra still generates and validates the one-time passcode. The Azure Function receives the request from Entra and sends it to Smstools for delivery.
Note: Microsoft recommends phishing-resistant methods such as passkeys over SMS and voice. BYOT is an option when a specific requirement calls for a provider outside the supported CYOT offers and telephony is still needed. Check coverage, commercial terms, fraud controls, and data handling with your provider.
What do you need?#
- A Microsoft Entra workforce tenant and an Azure subscription with a valid payment method.
- A Smstools account with access to the channels and destinations you want to use, available credit, API credentials, and an approved SMS sender.
- Azure Cloud Shell in PowerShell mode, or PowerShell 7.0+ and Azure CLI 2.61+.
- A test user with a phone number registered for the authentication method you want to test.
- A separate test environment to validate the integration before rolling it out.
Confirm pricing and channel availability with Smstools. Azure hosting and provider delivery are separate costs. A provider being based in Europe, or selecting an EU Azure region, does not by itself guarantee where all message data is processed.
Permissions#
| Task | Needed |
|---|---|
| Create the app registration | Permission to register applications |
| Deploy Azure resources and assign roles | Subscription Owner, or Contributor plus Role Based Access Control Administrator |
| Grant directory permissions during deployment | Privileged Role Administrator |
| Read and update the authentication method policy | Authentication Policy Administrator, with the appropriate delegated Microsoft Graph permissions |
Check your Entra application management policies before you start. The setup creates or configures an app registration and an encryption certificate. For the API-key provider, the endpoint application is single-tenant. If you reuse an application with existing encryption certificates, read the deployment plan carefully: replacing a certificate can affect other endpoints using that application.
Set up Smstools#
Create a subscription directly with Smstools, or sign in with an existing account. Make sure your account can send to the countries and channels you want to test, and that it has sufficient credit.
Create API credentials and keep both the client ID and client secret available for the Key Vault step later. Do not paste the secret into the setup script, a screenshot, or the Function App settings.
For SMS, add or select an approved sender under Manage senders. The setup script asks for this sender name. The Smstools profile requires it even if you are initially testing voice, so have it ready before you deploy.
Run the setup script#
Open Azure Cloud Shell in PowerShell mode, or use a local PowerShell 7 session with Azure CLI. Download the launcher from my fork:
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/BakkerJan/ExternalPhoneProvider-AzureFunction-Sample/main/setup/Setup-Epp.ps1' -OutFile '.\Setup-Epp.ps1'Review the script, then run it:
.\Setup-Epp.ps1The launcher defaults to my fork, which includes the Smstools adapter. It downloads the setup files and the released Function package. For a repeatable deployment, review and pin the source revision and matching package release as described in the setup reference.
The wizard, step by step#
- Tenant and subscription. Select the tenant and Azure subscription for the integration.
- Application. Create a dedicated app registration, or select an existing one intended for this endpoint. Record the application client ID and resource prefix for reruns.
- Azure region and provider. Select a region that meets your latency, availability, and data-handling requirements. The suggested region and the provider route are separate choices. Select the provider; in this case, we pick Smstools.
- Smstools settings, hosting plan, and resource prefix. Enter the approved SMS sender. The voice language defaults to
en-GB; voice gender is optional. These are configuration settings, not API credentials. Choose Flex Consumption or Premium. The sample’s default Flex configuration has no always-ready instances and can cold-start; Premium keeps a warm instance and has a baseline cost. Account for latency as well as cost. Choose a prefix for the Azure resources. Keep it with the client ID for future reruns.
- Review and deploy. Read the plan, including permissions, certificate handling, provider URLs, resource names, and source/package versions. Enter Yes only when you are ready to deploy. Pressing Enter at the final prompt cancels the deployment.
Resource names are derived from the subscription, application client ID, and resource prefix. Reuse those same values when rerunning setup; a different app or prefix can create a second deployment with a different Function URL. The Key Vault has purge protection and a 90-day soft-delete retention period, so deleting and rebuilding is not necessarily a clean reset. Check whether the vault can be recovered before trying to reuse its name.
When deployment completes, save the deployment summary in a restricted location. You will need the endpoint URL, application client ID, Key Vault name, and provider settings. Also record the certificate expiration and assign an owner for renewal.
After the deployment is done, you can find your resources through the Azure portal.
Add the Smstools credentials to Key Vault#
The setup creates disabled placeholder secrets for the Smstools credentials; it does not ask for their values. In the Azure portal, open the Key Vault from the deployment summary and go to Secrets. For each secret, create a new enabled version with the corresponding value from Smstools:
| Key Vault secret | Smstools value |
|---|---|
smstools-client-id | API client ID |
smstools-client-secret | API client secret |
Do not enable the placeholder values. The Function’s managed identity reads the credentials from Key Vault for live requests. Unlike the Soprano setup in my previous post, this API-key integration does not require the provider to authorize your Entra application through federation.
The client ID and secret can be copied (and renewed if needed) from the Smstools portal.
Configure the voice or sender name (optional)#
Smstools supports SMS and voice through separate provider endpoints. The setup configures both; for voice, the Function sends requests to https://api.smsgatewayapi.com/v1/voice/send. Entra still calls the same Function endpoint for either channel.
Some parameters, like the gender of the voice or sender name, can be changed through the Function App variables.
In the Azure portal, open Function App > Settings > Environment variables and set SMSTOOLS_VOICE_GENDER to Female or Male. Leave it unset to use the provider’s default. This optional setting may not be prompted for during setup. Save the change and let the Function restart before testing a call.
Configure the authentication method policy#
BYOT configuration uses Microsoft Graph. Start with SMS in a test tenant, and repeat the process for voice only if your Smstools account and intended destinations support it. SMS and voice have separate policies, even when they use the same Function endpoint.
Warning: These are the existing SMS and voice policies, not separate BYOT-only targeting policies. Changing their targets can affect current users. Save the existing policy and preserve its state, targets, and other settings. Test targeting changes in a test tenant.
Open Graph Explorer, sign in to the correct tenant, and select beta. Use GET to read the current SMS configuration:
GET https://graph.microsoft.com/beta/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/smsConsent to Policy.Read.AuthenticationMethod if needed. Save the complete response securely before making changes. Read and save the voice configuration separately:
GET https://graph.microsoft.com/beta/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/voiceStart with evaluation#
With the Authentication Policy Administrator role active, consent to Policy.ReadWrite.AuthenticationMethod. Use the endpoint URL and application client ID from the deployment summary in this SMS request:
PATCH https://graph.microsoft.com/beta/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/sms
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.smsAuthenticationMethodConfiguration",
"telecomProviderSettings": {
"url": "<YOUR-ENDPOINT-URL>",
"appId": "<YOUR-APPLICATION-CLIENT-ID>",
"isEvaluationModeEnabled": true,
"migrationPercentage": 1
}
}For voice, use the same Function endpoint URL and application client ID, but update the voice policy with its own request:
PATCH https://graph.microsoft.com/beta/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/voice
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.voiceAuthenticationMethodConfiguration",
"telecomProviderSettings": {
"url": "<YOUR-ENDPOINT-URL>",
"appId": "<YOUR-APPLICATION-CLIENT-ID>",
"isEvaluationModeEnabled": true,
"migrationPercentage": 1
}
}The percentage is an example sampling rate, not a separate user target. During evaluation, it controls how many eligible requests are sampled; with evaluation disabled, it controls live routing. A zero sampling percentage will not exercise the integration, so use a nonzero value to test. These requests leave the existing policy state and targets out of the update. After the expected 204 No Content, run GET again for each changed policy and verify the provider settings and existing targets.
Note: These examples use Microsoft Graph beta, which is subject to change and not supported for production applications. Check Microsoft’s current BYOT guidance and your tenant’s supported administration procedure before changing production policies.
You can also use the Entra admin center to change the configuration.
Test the integration#
In an InPrivate browser, sign in as the test user and complete SMS or voice authentication for the channel you are testing. In the Azure portal, open Function App > Functions > SendOtp > Invocations and look for a successful evaluation request. In the Entra audit logs, filter for Azure MFA and check for CyotEvaluation.
Evaluation checks the Entra-to-Function path, including authentication and decryption. It does not send a message through Smstools. Microsoft continues delivering the actual messages during evaluation. With sampling below 100%, not every attempt produces an evaluation request.
After evaluation succeeds, arrange a controlled live test. Update the same four provider settings with isEvaluationModeEnabled set to false and an agreed initial migrationPercentage. Read the policy back, then sign in again and confirm that the code arrives and authentication completes. Check the Function invocation, the Entra audit log for Cyot, and the delivery outcome in Smstools. An HTTP 200 from the Function confirms provider acceptance, not necessarily delivery to the phone.
For every test, you can also cross-check on the SMS or voice provider’s side whether the message or call was delivered.
If a request fails, check the Function’s structured logs for the provider status, elapsed time, and failure reason, then check the Smstools account and available credit. Keep phone numbers, passcodes, tokens, and raw provider responses out of screenshots and support requests. The configured provider timeout applies to the outbound provider call; the Function invocation duration also includes time spent starting and running the host. A cold start can therefore make the total much longer than the provider call alone.
Of course, the best test is seeing the SMS come in on your mobile phone :)
A note on voice pacing#
During my English-language test call, I found the message difficult to catch as a Dutch listener, even though it was played twice. The first digit ran into the preceding word, so I did not hear it clearly as a number.
Before the change:
Use verification code 3, 6, 9, 7, 0, 6 for Microsoft authentication. Use verification code 3, 6, 9, 7, 0, 6 for Microsoft authentication.I worked on an improvement that adds a pause before and after the passcode, as well as a longer pause between its digits. The message is still repeated twice. I also submitted the change to the Microsoft sample as a pull request; at the time of writing, it is still open.
If you use my sample code, this improvement is already in place. It now plays more slowly, so it is easier to understand. So if you use the voice channel, you might get:
Use verification code. 9. 7. 0. 6. 7. 9. for Microsoft authentication. Use verification code. 9. 7. 0. 6. 7. 9. for Microsoft authentication.Let’s wrap up#
BYOT gives you another route when you need a provider outside the CYOT offers. In this example, the Smstools subscription and credentials are managed directly with the provider, while the Azure Function and Graph policy connect it to Entra.
The integration is now part of your authentication infrastructure. Plan for certificate and API credential rotation, monitoring, recovery, provider availability, and costs. Work with Smstools on destination restrictions, usage limits, and fraud protection before moving production traffic. Test rollback and keep a non-telephony recovery method available.



















Comments
Comments load when you scroll here.