Skip to content

Commit 2fc2d8d

Browse files
authored
Merge pull request #285279 from AndrewNivenMSFT/aniven/assorted-apc-improvements
Improve auth instructions for APC and other small improvements
2 parents dd9fafe + 325fa29 commit 2fc2d8d

File tree

2 files changed

+72
-49
lines changed

2 files changed

+72
-49
lines changed

articles/programmable-connectivity/azure-programmable-connectivity-create-gateway.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Create an Azure Programmable Connectivity Gateway
3-
description: In this guide, learn how to create an APC gateway.
3+
description: In this guide, learn how to create an APC Gateway.
44
author: anzaman
55
ms.author: alzam
66
ms.service: azure-programmable-connectivity
@@ -9,29 +9,34 @@ ms.date: 07/22/2024
99
ms.custom: template-overview
1010
---
1111

12-
# Quickstart: Create an APC gateway
12+
# Quickstart: Create an APC Gateway
1313

1414
In this quickstart, you learn how to create an Azure Programmable Connectivity (APC) gateway and subscribe to API plans in the Azure portal.
1515

1616
> [!NOTE]
17-
> Deleting and modifying existing APC gateways is not supported during the preview. Please open a support ticket in the Azure Portal if you need to delete an APC Gateway.
17+
> Deleting and modifying existing APC Gateways is not supported during the preview. Please open a support ticket in the Azure Portal if you need to delete an APC Gateway.
18+
>
19+
20+
> [!NOTE]
21+
> Moving an APC Gateway to a different resource group is not supported. If you need to move an APC Gateway to a different resource group, you must delete it and recreate it.
1822
>
1923
2024
## Prerequisites
2125

2226
- If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
27+
- Register your Azure subscription with the provider `Microsoft.ProgrammableConnectivity`, following [these instructions](/azure/azure-resource-manager/management/resource-providers-and-types)
2328

2429
### Sign in to the Azure portal
2530

2631
Sign in to the [Azure portal](https://portal.azure.com).
2732

28-
### Create a new APC gateway
33+
### Create a new APC Gateway
2934

3035
1. In the Azure portal, Search for **APC Gateways** and then select **Create**.
3136

3237
:::image type="content" source="media/search.jpg" alt-text="Screenshot of Azure portal showing the search box." lightbox="media/search.jpg":::
3338

34-
1. Select the **Subscription**, **Resource Group** and **Region** for the gateway.
39+
1. Select the **Subscription**, **Resource Group**, and **Region** for the gateway.
3540

3641
:::image type="content" source="media/create.jpg" alt-text="Screenshot of the create gateway page in Azure portal." lightbox="media/create.jpg":::
3742

@@ -50,9 +55,9 @@ Sign in to the [Azure portal](https://portal.azure.com).
5055

5156
### Provide application details
5257

53-
In order to use the operators API, you must provide extra details, which will be shared with the operator.
58+
In order to use the operators' APIs, you must provide extra details, which are shared with the operators.
5459

55-
1. Fill out the Application name, Application description, Legal entity, Tax number and the privacy manger's email address in the text boxes.
60+
1. Fill out the Application name, Application description, Legal entity, Tax number, and the privacy manager's email address in the text boxes.
5661

5762
:::image type="content" source="media/app-details.jpg" alt-text="Screenshot of the application details page in the Azure portal." lightbox="media/app-details.jpg":::
5863

@@ -66,11 +71,19 @@ On the **Terms and Conditions** page.
6671

6772
:::image type="content" source="media/terms.jpg" alt-text="Screenshot of the terms and conditions page in the Azure portal." lightbox="media/terms.jpg":::
6873

69-
1. Repeat the above step for each line.
74+
1. Repeat for each line.
7075
1. Click **Next**.
7176

7277
### Verify details and create
7378

7479
Once you see the **Validation passed** message, click **Create**.
7580

7681
:::image type="content" source="media/verify-create.jpg" alt-text="Screenshot of the verify and create page in Azure portal." lightbox="media/verify-create.jpg":::
82+
83+
### Wait for approval
84+
85+
On clicking **Create** your APC Gateway and one or more Operator API Connections are created. Each Operator API Connection represents a connection between your APC Gateway and a particular API at a particular operator.
86+
87+
Operator API Connections don't finish deploying until the relevant operator has approved your onboarding request. For some operators approval is a manual process, and so may take several days.
88+
89+
After an operator approves your onboarding request for an Operator API Connection, you are able to use APC with that Operator API Connection. This is the case even if your APC Gateway has other Operator API Connections that are not yet approved, with that operator or with another operator.

articles/programmable-connectivity/azure-programmable-connectivity-using-network-apis.md

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,10 @@ Create an APC Gateway, following instructions in [Create an APC Gateway](azure-p
2020

2121
- Obtain the Resource ID of your APC Gateway. This can be found by navigating to the APC Gateway in the Azure portal, clicking `JSON View` in the top right, and copying the value of `Resource ID`. Note this as `APC_IDENTIFIER`.
2222
- Obtain the URL of your APC Gateway. This can be found by navigating to the APC Gateway in the Azure portal, and obtaining the `Gateway base URL` under Properties. Note this as `APC_URL`.
23-
24-
## Obtain an authentication token
25-
26-
1. Follow the instructions at [How to create a Service Principal](/entra/identity-platform/howto-create-service-principal-portal) to create an App Registration that can be used to access your APC Gateway.
27-
- For the step "Assign a role to the application", go to the APC Gateway in the Azure portal and follow the instructions from `3. Select Access Control (IAM)` onwards. Assign the new App registration the `Azure Programmable Connectivity Gateway Dataplane User` role.
28-
- At the step "Set up authentication", select "Option 3: Create a new client secret". Note the value of the secret as `CLIENT_SECRET`, and store it securely (for example in an Azure Key Vault).
29-
- After you have created the App registration, copy the value of Client ID from the Overview page, and note it as `CLIENT_ID`.
30-
2. Navigate to "Tenant Properties" in the Azure portal. Copy the value of Tenant ID, and note it as `TENANT`.
31-
3. Obtain a token from your App Registration. This can be done using an HTTP request, following the instructions in the [documentation](/entra/identity-platform/v2-oauth2-client-creds-grant-flow#first-case-access-token-request-with-a-shared-secret). Alternatively, you can use an SDK (such as those for [Python](/entra/msal/python/), [.NET](/entra/msal/dotnet/), and [Java](/entra/msal/java/)).
32-
- When asked for `client_id`, `client_secret`, and `tenant`, use the values obtained in this process. Use `https://management.azure.com//.default` as the scope.
33-
4. Note the value of the token you have obtained as `APC_AUTH_TOKEN`.
23+
- APC uses [Azure RBAC](/azure/role-based-access-control/overview) to control access. Choose the identity that you are going to use to access APC. This can be your own user identity, a [Service Principal](/entra/identity-platform/app-objects-and-service-principals), or a [Managed Identity](/entra/identity/managed-identities-azure-resources/overview). Add the role assignment `Azure Programmable Connectivity Gateway Dataplane User` for your chosen identity over a scope that includes your APC Gateway (e.g. the APC Gateway itself, the Resource Group that contains it, or the Subscription that contains it). For more details, see the following instructions:
24+
- [Assign Azure roles using the Azure portal](/azure/role-based-access-control/role-assignments-portal)
25+
- [Assign Azure roles using Azure CLI](/azure/role-based-access-control/role-assignments-cli)
26+
- [Assign Azure roles using Azure PowerShell](/azure/role-based-access-control/role-assignments-powershell)
3427

3528
## Use an API
3629

@@ -41,17 +34,6 @@ Create an APC Gateway, following instructions in [Create an APC Gateway](azure-p
4134
- Phone number: a phone number in E.164 format (starting with country code), optionally prefixed with '+'.
4235
- Hashed phone number: the SHA-256 hash, in hexadecimal representation, of a phone number
4336

44-
#### Headers
45-
46-
All requests must contain the following headers:
47-
48-
- `Authorization`: This must have the value of `<APC_AUTH_TOKEN>` obtained in [Obtain an authentication token](#obtain-an-authentication-token).
49-
- `apc-gateway-id`: This must have the value of `<APC_IDENTIFIER>` obtained in [Prerequisites](#prerequisites).
50-
51-
Requests may also contain the following optional header:
52-
53-
- `x-ms-client-request-id`: This is a unique ID to identify the specific request. This is useful for diagnosing and fixing errors.
54-
5537
#### Network identifier
5638

5739
Each request body contains the field `networkIdentifier`. This object contains the fields `identifierType` and `identifier`. These values are used to identify which Network a request should be routed to.
@@ -63,17 +45,45 @@ APC can identify the correct Network in one of three ways:
6345

6446
| Operator | NetworkCode |
6547
| -------- | ----------- |
66-
| Claro Brazil | Claro_Brazil |
67-
| Telefonica Brazil | Telefonica_Brazil |
68-
| TIM Brazil | Tim_Brazil |
69-
| Orange Spain | Orange_Spain |
7048
| Telefonica Spain | Telefonica_Spain |
7149

72-
### Retrieve the last time that a SIM card was changed
50+
### Contact APC using an SDK
7351

74-
Make a POST request to the endpoint `https://<APC_URL>/sim-swap/sim-swap:verify`.
52+
You can use a .NET SDK to contact APC. For more information and usage samples, see the [documentation](/dotnet/api/overview/azure/communication.programmableconnectivity-readme).
53+
54+
If you use the .NET SDK, it is recommended that you also use the [.NET Entra Authentication SDK](/entra/msal/dotnet/).
55+
56+
### Contact APC using HTTP requests
57+
58+
#### Obtain an auth token
59+
60+
To contact APC using HTTP requests, you must obtain an auth token, and set the header `Authorization` to the value of this token. There are numerous ways to do this. Some examples are shown below.
61+
62+
# [Obtain a token for a Service Principal](#tab/service-principal)
63+
64+
To obtain a token for a Service Principal, follow instructions in the [Entra documentation](/entra/identity-platform/v2-oauth2-client-creds-grant-flow#get-a-token)
7565

76-
It must contain all common headers specified in [Headers](#headers).
66+
# [Obtain a token for your own user identity](#tab/user-identity)
67+
68+
Obtain a token for your own user identity using the Azure CLI command [get-access-token](/cli/azure/account?view=azure-cli-latest#az-account-get-access-token&preserve-view=true) or the PowerShell command [Get-AzAccessToken](/powershell/module/az.accounts/get-azaccesstoken). Set the `--resource` parameter (in Azure CLI) or the `-ResourceUrl` parameter (in PowerShell) to `https://management.azure.com/`.
69+
70+
---
71+
72+
#### Set other headers
73+
74+
All requests must contain the following header:
75+
76+
- `apc-gateway-id`: This must have the value of `<APC_IDENTIFIER>` obtained in [Prerequisites](#prerequisites).
77+
78+
Requests may also contain the following optional header:
79+
80+
- `x-ms-client-request-id`: This is a unique ID to identify the specific request. This is useful for diagnosing and fixing errors.
81+
82+
#### Retrieve the last time that a SIM card was changed
83+
84+
Make a POST request to the endpoint `https://<APC_URL>/sim-swap/sim-swap:retrieve`.
85+
86+
It must contain a [bearer token](#obtain-an-auth-token) and [other required headers](#set-other-headers).
7787

7888
The body of the request must take the following form. Replace the example values with real values.
7989

@@ -101,11 +111,11 @@ The response is of the form:
101111

102112
`date` contains the timestamp of the most recent SIM swap in the `date-time` format defined in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6). `date` may be `null`: this means that the SIM has never been swapped, or has not been swapped within the timeframe that the Operator maintains data for.
103113

104-
### Verify that a SIM card has been swapped in a certain time frame
114+
#### Verify that a SIM card has been swapped in a certain time frame
105115

106-
Make a POST request to the endpoint `https://<APC_URL>/sim-swap/sim-swap:retrieve`.
116+
Make a POST request to the endpoint `https://<APC_URL>/sim-swap/sim-swap:verify`.
107117

108-
It must contain all common headers specified in [Headers](#headers).
118+
It must contain a [bearer token](#obtain-an-auth-token) and [other required headers](#set-other-headers).
109119

110120
The body of the request must take the following form. Replace the example values with real values.
111121

@@ -136,11 +146,11 @@ The response is of the form:
136146

137147
`verificationResult` is a boolean, which is true if the SIM has been swapped in the specified time period, and false otherwise.
138148

139-
### Verify the location of a device
149+
#### Verify the location of a device
140150

141151
Make a POST request to the endpoint `https://<APC_URL>/device-location/location:verify`.
142152

143-
It must contain all common headers specified in [Headers](#headers).
153+
It must contain a [bearer token](#obtain-an-auth-token) and [other required headers](#set-other-headers).
144154

145155
The body of the request must take one of the following forms, which vary on the format used to identify the device. Replace the example values with real values.
146156

@@ -234,17 +244,17 @@ The response is of the form:
234244

235245
`verificationResult` is a boolean, which is true if the device is within a certain distance (given by `accuracy`) of the given location, and false otherwise.
236246

237-
### Verify the number of a device
247+
#### Verify the number of a device
238248

239249
Number verification is different to other APIs, as it requires interaction with a frontend application (i.e. an application running on a device) to verify the number of that device, as part of a flow referred to as "frontend authorization". This means two separate calls to APC must be made: the first to trigger frontend authorization, and the second to request the desired information.
240250

241251
To use number verification functionality, you must expose an endpoint on the backend of your application that is accessible from your application's frontend. This endpoint is used to pass the result of frontend authorization to the backend of your application. Note the full URL to this endpoint as `REDIRECT_URI`.
242252

243-
#### Call 1
253+
##### Frontend authorization call
244254

245255
Make a POST request to the endpoint `https://<APC_URL>/number-verification/number:verify`.
246256

247-
It must contain all common headers specified in [Headers](#headers).
257+
It must contain a [bearer token](#obtain-an-auth-token) and [other required headers](#set-other-headers).
248258

249259
The body of the request must take one of the following forms. Replace the example values with real values.
250260

@@ -284,13 +294,13 @@ At the end of the authorization flow, the Network returns a 302 redirect. This r
284294

285295
The frontend of your application must follow this `redirectUri`. This delivers the `apcCode` to your application's backend.
286296

287-
#### Call 2
297+
##### Number Verification call
288298

289299
At the end of Call 1, your frontend made a request to the endpoint exposed at `redirectUri` with a parameter `apcCode`. Your backend must obtain the value of `apcCode` and use it in the second call to APC.
290300

291301
Make a POST request to the endpoint `https://<APC_URL>/number-verification/number:verify`.
292302

293-
It must contain all common headers specified in [Headers](#headers).
303+
It must contain a [bearer token](#obtain-an-auth-token) and [other required headers](#set-other-headers).
294304

295305
The body of the request must take the following form. Replace the value of `apcCode` with the value obtained as a result of the authorization flow.
296306

@@ -310,11 +320,11 @@ The response is of the form:
310320

311321
`verificationResult` is a boolean, which is true if the device has the number (or hashed number) specified in Call 1, and false otherwise.
312322

313-
### Obtain the Network of a device
323+
#### Obtain the network of a device
314324

315325
Make a POST request to the endpoint `https://<APC_URL>/device-network/network:retrieve`.
316326

317-
It must contain all common headers specified in [Headers](#headers).
327+
It must contain a [bearer token](#obtain-an-auth-token) and [other required headers](#set-other-headers).
318328

319329
The body of the request must take the following form. Replace the example values with real values.
320330

0 commit comments

Comments
 (0)