|
| 1 | +--- |
| 2 | +title: Get started with Azure AD authentication by using the Azure portal |
| 3 | +description: Learn how to use the Azure portal to access Azure Active Directory (Azure AD) authentication to consume the Azure Media Services API. |
| 4 | +services: media-services |
| 5 | +documentationcenter: '' |
| 6 | +author: Juliako |
| 7 | +manager: femila |
| 8 | +editor: '' |
| 9 | + |
| 10 | +ms.service: media-services |
| 11 | +ms.workload: media |
| 12 | +ms.tgt_pltfrm: na |
| 13 | +ms.devlang: na |
| 14 | +ms.topic: how-to |
| 15 | +ms.date: 03/09/2020 |
| 16 | +ms.author: juliako |
| 17 | +--- |
| 18 | +# Use the Azure portal to get credentials to access Media Services API |
| 19 | + |
| 20 | +When you use Azure AD authentication to access the Azure Media Services API, you have two authentication options: |
| 21 | + |
| 22 | +- **Service principal authentication**. Authenticate a service. Applications that commonly use this authentication method are apps that run daemon services, middle-tier services, or scheduled jobs: web apps, function apps, logic apps, APIs, or a microservice. |
| 23 | +- **User authentication**. Authenticate a person who is using the app to interact with Media Services resources. The interactive application should first prompt the user for credentials. An example is a management console app used by authorized users to monitor encoding jobs or live streaming. |
| 24 | + |
| 25 | +This article shows you how to use the Azure portal to get credentials to access Media Services API. |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | + |
| 29 | +- An Azure account. If you don't have an account, start with an [Azure free trial](https://azure.microsoft.com/pricing/free-trial/). |
| 30 | +- A Media Services account. For more information, see [Create an Azure Media Services account by using the Azure portal](create-account-portal.md). |
| 31 | + |
| 32 | +## API access |
| 33 | + |
| 34 | +The **API access** page lets you select the authentication method you want to use to connect to the API. The page also provides the values you need to connect to the API. |
| 35 | + |
| 36 | +1. In the [Azure portal](https://portal.azure.com/), select your Media Services account. |
| 37 | +2. Select how to connect to the Media Services API. |
| 38 | +3. Under **Connect to Media Services API**, select the Media Services API version you want to connect to (V3 is the latest version of the service). |
| 39 | + |
| 40 | +## Service principal authentication (recommended) |
| 41 | + |
| 42 | +Authenticates a service using an Azure Active Directory (Azure AD) app and secret. This is recommended for any middle-tier services calling to the Media Services API. Examples are Web Apps, Functions, Logic Apps, APIs, and microservices. This is the recommended authentication method. |
| 43 | + |
| 44 | +### Manage your Azure AD app and secret |
| 45 | + |
| 46 | +The **Manage your AAD app and secret** section lets you select or create a new Azure AD app and generate a secret. For security purposes, the secret cannot be shown after the blade is closed. The application uses the application ID and secret for authentication to obtain a valid token for media services. |
| 47 | + |
| 48 | +Make sure that you have sufficient permissions to register an application with your Azure AD tenant and to assign the application to a role in your Azure subscription. For more information, see [Required permissions](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#required-permissions). |
| 49 | + |
| 50 | +### Connect to Media Services API |
| 51 | + |
| 52 | +The **Connect to Media Services API** provides you with values that you use to connect your service principal application. You can get text values or copy the JSON or XML blocks. |
| 53 | + |
| 54 | +## User authentication |
| 55 | + |
| 56 | +This option could be used to authenticate an employee or member of an Azure Active Directory who is using an app to interact with Media Services resources. The interactive application should first prompt the user for the user's credentials. This authentication method should only be used for Management applications. |
| 57 | + |
| 58 | +### Connect to Media Services API |
| 59 | + |
| 60 | +Copy your credentials to connect your user application from the **Connect to Media Services API** section. You can get text values or copy the JSON or XML blocks. |
| 61 | + |
| 62 | +## Next steps |
| 63 | + |
| 64 | +[Tutorial: Upload, encode, and stream videos with Media Services v3](stream-files-tutorial-with-api.md). |
0 commit comments