# Deploy from Azure Marketplace

{% hint style="warning" %}
**Note:** The deployment steps detailed below are intended for **Azure Marketplace deployment**. The steps for manual/local deployment via Bicep can be found [here](manual-deployment).
{% endhint %}

## Create a managed application

1.  Type "**Marketplace**" in the [Azure portal](https://portal.azure.com) search bar and select said option as it appears.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FPNN1g3hFfXVbickOnims%2F9.4%20(1).png?alt=media&#x26;token=1b2ba0b5-9264-4c89-91f8-9e310bee2182" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
**Warning:** Azure Marketplace can be opened in 2 ways:\
\
Method 1 - Opening it as shown in step 1, which takes you here: <img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FkXzkhfJpPFFK817W7Yym%2Fimage.png?alt=media&#x26;token=2d6579fe-f0b4-4e3b-bbf4-542264b93a72" alt="" data-size="original">

Method 2 - Opening it [directly](https://azuremarketplace.microsoft.com/en-us/marketplace/) (not from the Azure portal), which takes you here: ![](https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2F5fhC5t2PjHsKA6uaRiOU%2Fimage.png?alt=media\&token=2aa3f33f-09b0-4a15-9c4e-f73dc0db2e5c)

To follow the deployment steps detailed below, you need to access Azure Marketplace using Method 1. The steps below will not align if you use Method 2.&#x20;
{% endhint %}



2. Search for the EmbedFAST and select the application from the search results.&#x20;

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2F4YevNt6YT2LsOC6QkuiF%2F14.2.png?alt=media&#x26;token=dd29ce94-d5a9-4463-be81-398c4405837c" alt=""><figcaption></figcaption></figure>

3.  Select a tier from the dropdown menu, then select **Create**.

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2F5tqQrsj8FDMOAEJXemyP%2F9.5%20(3).png?alt=media&#x26;token=bfca2031-13f3-45bc-9929-d68a8206e6b6" alt=""><figcaption></figcaption></figure>
4.  Fill the form as detailed below:

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FIIDyCz6n06XOCoc4erap%2F9.6.png?alt=media&#x26;token=ed4a7bbc-88ed-41b9-90ff-157a407e4512" alt=""><figcaption></figcaption></figure>

* Project details
  * Subscription: Choose the subscription where you want to keep the managed application.
  * Resource group: Choose the resource group where you want to keep the managed application.
* Instance details
  * &#x20;Region: Select a region that has the subscription selected in the previous field.&#x20;
* Application details
  * App name: Create and enter a name. Marketplace will validate if this name is available for resources that will be deployed.
  * App service pricing plan: Select an SKU value.
* SQL details
  * Server admin login: Username for the SQL Server login.
  * Password: A strong password for the SQL Server.
  * Confirm password: Confirm password.
* Managed Application Details
  * Application Name: Create and enter a name. This will be the name of the managed application where the Azure resources for the tool will reside.
  * Managed Resource Group: This field will be prepopulated when the form is opened. By default, the managed resource group name will be in this format: "**mrg-powerbiloadanalyzer-**", but you can change it to any name you want.

5. Click on **Next** to validate your inputs.
6.  Review the details shown on the **Review + create** page. Select **Create** to finalize the process. A managed application will be created under the selected resource group, where all the resources are deployed with one click.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FmmEUZpf87h6qIVtIWO1D%2F9.10.png?alt=media&#x26;token=ee5ccfc6-c019-4e1d-9e07-6c38f8cf6b33" alt=""><figcaption></figcaption></figure>
7.  Select the managed application.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fq2K4ZhrvLorahtqmyOOc%2F14.3.png?alt=media&#x26;token=8cd05dc0-1458-4b3d-aca6-f19bd5da607a" alt=""><figcaption></figcaption></figure>
8.  Click on the **Managed resource group** value on right side of the page if you want to go to the managed resource group where all the resources are deployed.

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FCbC7vdV3UxsYzqysnq83%2F14.4.png?alt=media&#x26;token=84d0f804-e69c-41d0-8a53-d73bfcbcec84" alt=""><figcaption></figcaption></figure>

## Load the post-deployment script and PowerShell file to Visual Studio Code 

1. Download the [PowerShell files](https://embedfastsolutionbuilds.blob.core.windows.net/powershellscripts/ManagedApplicationPostDeploymentScript.zip).
2.  Extract the folder and open it in Visual Studio Code (VS Code). The loaded files should look like this:\


    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FZtlLqFZw7XM8YtnOD1Fh%2F9.7.png?alt=media&#x26;token=af726844-f1a5-41d2-a0fe-d870ad30ac60" alt=""><figcaption></figcaption></figure>

### **Open a terminal window**

From the top menu bar, select **Terminal** -> **New Terminal** to access the PowerShell terminal window.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2F0Z9PTluuR6t7e0HXjqFf%2F9.8.png?alt=media&#x26;token=4fa1ba06-3c71-4e17-b98b-da2bb38ba413" alt=""><figcaption></figcaption></figure>

## **Executing the PowerShell script while bypassing the execution policy**

This step is required to bypass an execution policy that doesn't allow the ZIP file to work with the PowerShell scripts.

1.  Execute command “_**powershell -ExecutionPolicy Bypass -File ".\PostDeploytmentScript.ps1"**_” in the termina&#x6C;_._ This command will execute a PowerShell script named "PostDeploytmentScript.ps1" while bypassing the execution policy.\


    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FgFg70VYZsr8GKJDFCEAn%2F9.9%20(1).png?alt=media&#x26;token=118ff120-7584-40e3-b1b6-997ac0c60562" alt=""><figcaption></figcaption></figure>
2. The system will display a variety of prompts. Provide the information as requested. More details regarding the prompts are provided below.

### **Enter your subscription ID**

Follow the steps below to find your subscription ID:

1.  Type “**Subscriptions**" in the [Azure portal](https://portal.azure.com) search bar and select said option as it appears.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FZ57b0CsXVqK20nnt20kW%2F6.8.png?alt=media&#x26;token=dc8b0fc2-68d8-4dd9-b12c-c77d35545d78" alt=""><figcaption></figcaption></figure>
2. Once on the page, you will see a list of resource groups displayed. Select the resource group that you have created earlier in the [prerequisites ](../../prerequisites/old-set-up-power-bi-and-azure#azure)section.
3. &#x20;Select the desired resource group from the list where you want to deploy your resources.
4.  Copy the subscription ID as shown below.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FnQF877CEpAatpCVDW6u3%2F6.9.png?alt=media&#x26;token=326af9e6-e067-4c21-aadb-5f777598e4ef" alt=""><figcaption></figcaption></figure>
5. In the PowerShell terminal, paste/enter the subscription ID from the previous step.&#x20;

### **Enter your tenant ID**

Navigate to your **Azure Active Directory** --> **Overview** and copy the tenant ID as shown below. Paste/enter the ID into the PowerShell terminal.

<div data-full-width="true"><figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fb1pQw8AxLiaqTb3pRBPo%2Fimage.png?alt=media&#x26;token=7c3d5e3e-5fc4-4ef4-ba9d-4e2fe161b19a" alt=""><figcaption></figcaption></figure></div>

### **Log into Azure through the PowerShell pop-up window**

Choose an account to log into Azure with.



<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FnaQWJc80wXdhjkhmZAgg%2Fimage.png?alt=media&#x26;token=61fe2f68-ad05-47d0-865d-cc1c25c25533" alt=""><figcaption></figcaption></figure>

### **Enter your managed resource group name**

This is the name of the managed resource group in your subscription where EmbedFAST’s resources will be deployed to. The managed resource group is created under the resource group that was created [earlier](../../prerequisites/old-set-up-power-bi-and-azure#azure) in the prerequisites section. Follow the steps below to find the name of your managed resource group:

1. Type “**Resource groups**" in the [Azure portal](https://portal.azure.com) search bar and select said option as it appears. &#x20;
2.  Find and select the managed application as shown in the image below:

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fq2K4ZhrvLorahtqmyOOc%2F14.3.png?alt=media&#x26;token=8cd05dc0-1458-4b3d-aca6-f19bd5da607a" alt=""><figcaption></figcaption></figure>
3.  Copy the name of the managed resource group.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FCbC7vdV3UxsYzqysnq83%2F14.4.png?alt=media&#x26;token=84d0f804-e69c-41d0-8a53-d73bfcbcec84" alt=""><figcaption></figcaption></figure>
4. Paste/enter the managed resource group name in the PowerShell terminal like the previous steps.&#x20;



### **Enter your application name**

Provide the name of your app (as selected in the [previous step](#create-a-managed-application)).



### **Enter your Azure AD Client ID**

This client ID is obtained from the overview page of the app registration previously created for the EmbedFAST API as part of the pre-deployment steps.  Follow the steps below to find your client ID:

1. Type “**App registrations**" in the [Azure portal](https://portal.azure.com) search bar and select said option as it appears.&#x20;

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fwg1006HCGzQ4sdHaZPUt%2Fimage.png?alt=media&#x26;token=484e1d8b-117c-4963-adb2-0145724bdc2f" alt=""><figcaption></figcaption></figure>

3. Click on **Owned applications** to see a list of applications you registered, including the ones for the API and Power BI Service done in the pre-deployment steps.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2F3WjPkl4RfO6eBPe99dRo%2F7.6.png?alt=media&#x26;token=bedc851a-005c-44e5-8a36-a9bf4a11850b" alt=""><figcaption></figcaption></figure>

4. Next to the **Display name** column is the **Application (client) ID** column which contains the information needed. Find the application registration created for the EmbedFAST API on the list and note down its client ID.
5. Alternatively, clicking the app's name takes you to its summary page where you can also find the client ID and copy it directly to your clipboard.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FrChHzhi6aWN1Yos3HNeh%2F7.7.png?alt=media&#x26;token=d2833f41-89b8-4d01-ab63-c1f7cc269c6e" alt=""><figcaption></figcaption></figure>



### **Enter your service principal application ID**

This application ID is obtained from the overview page of the app registration previously created for the Power BI Service as part of the pre-deployment steps.

{% hint style="info" %}
**Note:**&#x20;

You can follow steps 1-3 [detailed above](#enter-your-azure-a-d-client-id) to obtain your service principal application ID for the Power BI Service. After step 3, find the application registration created for the Power BI Service on the list and note down its client ID.
{% endhint %}

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FyzO2oPuAiqB9vCk6sKsu%2F7.8.png?alt=media&#x26;token=8d73d110-5d11-444e-b035-baf2bb9a8dbd" alt=""><figcaption></figcaption></figure>



### **Enter your service principal object ID**

The object ID is obtained from the enterprise application created for the Power BI Service, which is created by default once we create an app registration for it. Follow the steps below to find the ID:

1. Type "**Enterprise applications**" in the [Azure portal](https://portal.azure.com) search bar and select said option as it appears.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FfNZ9vFGomcVoIzlpfS4d%2F7.9.png?alt=media&#x26;token=8fe9bfba-7277-408e-8d0b-2050e6fd4d8d" alt=""><figcaption></figcaption></figure>

3.  Search for the name of the app registration created for Power BI Service in the search bar. Your enterprise application will be under the same name.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FQlQzfPfV2CHRc82Kgzis%2F8.0.png?alt=media&#x26;token=0a38b69a-096f-470e-b668-2b71245a8166" alt=""><figcaption></figcaption></figure>
4. Click on the application's name to access its details page.&#x20;
5.  Copy the object ID from the **Object ID** field displayed on the application details page, as shown below.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2F6XVuDdUGsJoExc6TeMq6%2F8.1.png?alt=media&#x26;token=afa7cf8a-4f8b-462d-8bf3-8c28b72e163c" alt=""><figcaption></figcaption></figure>

### **Enter your service principal name**

On the same page where the [object ID](#enter-your-service-principal-object-id) was obtained from, you can find the name of your service principal at the top left corner of your page.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FORStb0INJQmeZz5rszCJ%2F8.2.png?alt=media&#x26;token=92c7eb20-472f-488d-8941-4bc7cc0d1439" alt=""><figcaption></figcaption></figure>

### **Enter your service principal client secret**&#x20;

Follow the steps below to create a client secret:

{% hint style="danger" %}
**Note: The client secret will only be visible at the time of creation.** Take note of it and store it securely for future use for whenever the client secret is required.
{% endhint %}

1.  Type “**App registrations**" in the [Azure portal](https://portal.azure.com) search bar and select said option as it appears.

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fwg1006HCGzQ4sdHaZPUt%2Fimage.png?alt=media&#x26;token=484e1d8b-117c-4963-adb2-0145724bdc2f" alt=""><figcaption></figcaption></figure>
2.  Click on **Owned applications** to see a list of applications you registered. Search for the application created for the Power BI Service on this page.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FEbyj2dBB8EvUQMtrTI3y%2F7.6.png?alt=media&#x26;token=8aa34e3d-47ca-4a38-8a15-61db34e33dd7" alt=""><figcaption></figcaption></figure>
3. Click on the application's name to access its details page.&#x20;
4. Select **Certificates & secrets** (under Manage) from the left pane.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FJ4Wv62WvCKKsn9ZJygoh%2F8.3.png?alt=media&#x26;token=3c97945b-dbcd-485d-bb0e-13a14e1bfbc0" alt=""><figcaption></figcaption></figure>

5. Click on **New client secret** to create a client secret.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FnnEOidQDe8iTEPEeQEGu%2F8.4.png?alt=media&#x26;token=3e7c7de4-7b23-48b0-84a6-d295b290738c" alt=""><figcaption></figcaption></figure>

6. Enter a description and select when the secret expires. Click on **Add** to add the client secret.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FNnCc7Kizlto350hYo0mX%2F8.5.png?alt=media&#x26;token=d5f42adc-81c2-4c9b-a7ef-d92589ff6853" alt=""><figcaption></figcaption></figure>

7. Copy the value of the newly created client secret as shown below.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FTot8kyoAYafsxR3stolL%2F8.6.png?alt=media&#x26;token=b8d68456-92a1-45c4-bcd3-01e97bda4410" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
**Reminder:** Take note of the client secret and store it securely for future use for whenever it is required. The client secret is only visible at the time of creation and will **NOT** be visible again.
{% endhint %}

### **Other details**

* **Enter the sender email:**  Provide an email address. This email will be used for sending subscription emails to other users.
* **Enter the sender email password:** Provide the password for the email address provided in the previous step.



## Initial post-deployment steps

Entering the email password prompted in the previous step completes the deployment process and prompts a menu to appear:&#x20;

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FfVJp3GzbG6vYQB6z5tdn%2F10.3.png?alt=media&#x26;token=b96bc64c-b3ae-46bd-933e-227be75d2c5d" alt=""><figcaption></figcaption></figure>

Enter "**1**" as your selection. A post-deployment operation will run that will perform the operations detailed below:

* Add your client IPv4 address to Set Server Firewall.
* Grant the necessary permissions to the service principal app registration on the Database. It will give admin access on the Database created.
* Add the Power BI App service principal as an external Azure AD user.
* Grant permissions to the user.

{% hint style="info" %}
**Note:** If an error occurs (e.g., “Client with IP address ‘IP-Address’ is not allowed to access the server”), you have the option to manually include the IP in the server's firewall rules. Follow the steps detailed below to do so:

1. Type “**Resource groups**" in the [Azure portal](https://portal.azure.com) search bar and select said option as it appears. &#x20;
2.  Find and select the managed application as shown in the image below:&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fq2K4ZhrvLorahtqmyOOc%2F14.3.png?alt=media&#x26;token=8cd05dc0-1458-4b3d-aca6-f19bd5da607a" alt=""><figcaption></figcaption></figure>
3.  Click on the **Managed resource group** value on right side of the page, it will take you to the managed resource group where all the resources are deployed. /

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FCbC7vdV3UxsYzqysnq83%2F14.4.png?alt=media&#x26;token=84d0f804-e69c-41d0-8a53-d73bfcbcec84" alt=""><figcaption></figcaption></figure>
4.  Select the SQL server deployed with the application's name.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FTDjtJYSz4jxSQgKDwy1s%2F13.4.png?alt=media&#x26;token=334abd7b-0fdf-4256-9b04-4ae32c7d0e50" alt=""><figcaption></figcaption></figure>
5. Select **Networking** (under Security) from the left pane.&#x20;
6.  Click on **Add a firewall rule**.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FBbJZGAVhTkLKHx7yLIGn%2F13.4.png?alt=media&#x26;token=32de4cf3-1ec9-4e91-8767-9124940e4fd9" alt=""><figcaption></figcaption></figure>
7.  Enter the IP address that was not allowed to access the server in the **Start IP** and **End IP** fields. Select **OK** to save the changes.&#x20;

    <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2FwtcVXxZeImrEYqHBCUWo%2F13.5.png?alt=media&#x26;token=4fd5edd2-cd93-44b6-a172-ff719e7412f0" alt=""><figcaption></figcaption></figure>
{% endhint %}

This completes the deployment process.\
