|
| 1 | +--- |
| 2 | +title: 'Create an enterprise application from a multi-tenant application' |
| 3 | +description: Create an enterprise application using the client ID for a multi-tenant application. |
| 4 | +services: active-directory |
| 5 | +author: omondiatieno |
| 6 | +manager: CelesteDG |
| 7 | +ms.service: active-directory |
| 8 | +ms.subservice: app-mgmt |
| 9 | +ms.topic: how-to |
| 10 | +ms.workload: identity |
| 11 | +ms.date: 07/26/2022 |
| 12 | +ms.author: jomondi |
| 13 | +ms.reviewer: karavar |
| 14 | +ms.custom: mode-other |
| 15 | +zone_pivot_groups: enterprise-apps-cli |
| 16 | + |
| 17 | + |
| 18 | +#Customer intent: As an administrator of an Azure AD tenant, I want to create an enterprise application using client ID for a multi-tenant application provided by a service provider or independent software vendor. |
| 19 | +--- |
| 20 | + |
| 21 | +# Create an enterprise application from a multi-tenant application in Azure Active Directory |
| 22 | + |
| 23 | +In this article, you'll learn how to create an enterprise application in your tenant using the client ID for a multi-tenant application. An enterprise application refers to a service principal within a tenant. The service principal discussed in this article is the local representation, or application instance, of a global application object in a single tenant or directory. |
| 24 | + |
| 25 | +Before you proceed to add the application using any of these options, check whether the enterprise application is already in your tenant by attempting to sign in to the application. If the sign-in is successful, the enterprise application already exists in your tenant. |
| 26 | + |
| 27 | +If you have verified that the application isn't in your tenant, proceed with any of the following ways to add the enterprise application to your tenant using the appId |
| 28 | + |
| 29 | +## Prerequisites |
| 30 | + |
| 31 | +To add an enterprise application to your Azure AD tenant, you need: |
| 32 | + |
| 33 | +- An Azure AD user account. If you don't already have one, you can [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 34 | +- One of the following roles: Global Administrator, Cloud Application Administrator, or Application Administrator. |
| 35 | +- The client ID of the multi-tenant application. |
| 36 | + |
| 37 | + |
| 38 | +## Create an enterprise application |
| 39 | + |
| 40 | +:::zone pivot="admin-consent-url" |
| 41 | + |
| 42 | +If you've been provided with the admin consent URL, navigate to the URL through a web browser to [grant tenant-wide admin consent](grant-admin-consent.md) to the application. Granting tenant-wide admin consent to the application will add it to your tenant. The tenant-wide admin consent URL has the following format: |
| 43 | + |
| 44 | +```http |
| 45 | +https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&client_id=248e869f-0e5c-484d-b5ea1fba9563df41&redirect_uri=https://www.your-app-url.com |
| 46 | +``` |
| 47 | +where: |
| 48 | + |
| 49 | +- `{client-id}` is the application's client ID (also known as appId). |
| 50 | + |
| 51 | +:::zone-end |
| 52 | + |
| 53 | +:::zone pivot="msgraph-powershell" |
| 54 | + |
| 55 | +1. Run `connect-MgGraph -Scopes "Application.ReadWrite.All"` and sign in with a Global Admin user account. |
| 56 | +1. Run the following command to create the enterprise application: |
| 57 | + |
| 58 | + ```powershell |
| 59 | + New-MgServicePrincipal -AppId fc876dd1-6bcb-4304-b9b6-18ddf1526b62 |
| 60 | + ``` |
| 61 | +1. To delete the enterprise application you created, run the command: |
| 62 | + |
| 63 | + ```powershell |
| 64 | + Remove-MgServicePrincipal |
| 65 | + -ServicePrincipalId <objectID> |
| 66 | + ``` |
| 67 | +:::zone-end |
| 68 | +:::zone pivot="ms-graph" |
| 69 | + |
| 70 | +From the Microsoft Graph explorer window: |
| 71 | + |
| 72 | +1. To create the enterprise application, insert the following query: |
| 73 | + |
| 74 | + ```http |
| 75 | + POST /servicePrincipals. |
| 76 | + ``` |
| 77 | +1. Supply the following request in the **Request body**. |
| 78 | + |
| 79 | + { |
| 80 | + "appId": "fc876dd1-6bcb-4304-b9b6-18ddf1526b62" |
| 81 | + } |
| 82 | +1. Grant the Application.ReadWrite.All permission under the **Modify permissions** tab and select **Run query**. |
| 83 | + |
| 84 | +1. To delete the enterprise application you created, run the query: |
| 85 | + |
| 86 | + ```http |
| 87 | + DELETE /servicePrincipals/{objectID} |
| 88 | + ``` |
| 89 | +:::zone-end |
| 90 | +:::zone pivot="azure-cli" |
| 91 | +1. To create the enterprise application, run the following command: |
| 92 | + |
| 93 | + ```azurecli |
| 94 | + az ad sp create --id fc876dd1-6bcb-4304-b9b6-18ddf1526b62 |
| 95 | + ``` |
| 96 | + |
| 97 | +1. To delete the enterprise application you created, run the command: |
| 98 | + |
| 99 | + ```azurecli |
| 100 | + az ad sp delete --id |
| 101 | + ``` |
| 102 | + |
| 103 | +:::zone-end |
| 104 | + |
| 105 | +## Next steps |
| 106 | + |
| 107 | +- [Add RBAC role to the enterprise application](/azure/role-based-access-control/role-assignments-portal) |
| 108 | +- [Assign users to your application](add-application-portal-assign-users.md) |
0 commit comments