> For the complete documentation index, see [llms.txt](https://maqsoftware.gitbook.io/embedfast-technical-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://maqsoftware.gitbook.io/embedfast-technical-documentation/setting-up/deployment/deploy-from-azure-marketplace.md).

# 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](/embedfast-technical-documentation/setting-up/deployment/manual-deployment.md).
{% 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.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-d8cfd4fddd2ba9962b3f2ee931636b5b9710f03a%2F9.4%20(1).png?alt=media" 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%2Fgit-blob-c49a53ed960954307ae9503b7e980878d3149c39%2Fimage.png?alt=media" 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%2Fgit-blob-e7f0d1257c6b9827fe5bd04bd4ff3d266f778e97%2Fimage%20\(3\)%20\(1\).png?alt=media)

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.
{% endhint %}

2. Search for the EmbedFAST and select the application from the search results.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-8fc26b4c23a273047369a84b7c4be0230c162c11%2F14.2.png?alt=media" 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%2Fgit-blob-780b293b8b0850c3a228f2644f12d156cf47ec0a%2F9.5%20(3).png?alt=media" 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%2Fgit-blob-e699c927e29b80d1340a3cf5cc427ab21b0dae00%2F9.6.png?alt=media" 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
  * Region: Select a region that has the subscription selected in the previous field.
* 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.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-97d4355637123050fb72a0cb3b3b94087e831d9c%2F9.10.png?alt=media" alt=""><figcaption></figcaption></figure>
7. Select the managed application.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-bdd7d078375d1813862337741f99e40c090dd93a%2F14.3%20(2).png?alt=media" 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%2Fgit-blob-783dca57bf83801eeaa90c9005d1a12edbe99e29%2F14.4.png?alt=media" 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%2Fgit-blob-2321b621268875ea78d187dd08f12af06bf5e71c%2F9.7.png?alt=media" 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%2Fgit-blob-0617afa84d6919efb3d38c0dac4f3c553ebe1576%2F9.8.png?alt=media" 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 ".\Master.ps1"***” in the termina&#x6C;*.* This command will execute a PowerShell script named "Master.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%2Fgit-blob-b5abfcd499ce0f73000833e519260ec8fc2f6233%2F9.9%20(1).png?alt=media" 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.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-9b8980bfc024158b64a371f28a8992a97c16f576%2F6.8.png?alt=media" 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 ](/embedfast-technical-documentation/setting-up/prerequisites/old-set-up-power-bi-and-azure.md#azure)section.
3. Select the desired resource group from the list where you want to deploy your resources.
4. Copy the subscription ID as shown below.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-536f9f1eb908fe66e05acae3ad1ae730b6692280%2F6.9.png?alt=media" alt=""><figcaption></figcaption></figure>
5. In the PowerShell terminal, paste/enter the subscription ID from the previous step.

### **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%2Fgit-blob-b43d920fc9c7309dd7aca65c828866a644dca618%2Fimage.png?alt=media" 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%2Fgit-blob-e27d1c3f8718fb084063b0cc619efa628cc6da8a%2Fimage.png?alt=media" 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](/embedfast-technical-documentation/setting-up/prerequisites/old-set-up-power-bi-and-azure.md#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.
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%2Fgit-blob-bdd7d078375d1813862337741f99e40c090dd93a%2F14.3%20(2).png?alt=media" alt=""><figcaption></figcaption></figure>
3. Copy the name of the managed resource group.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-783dca57bf83801eeaa90c9005d1a12edbe99e29%2F14.4.png?alt=media" alt=""><figcaption></figcaption></figure>
4. Paste/enter the managed resource group name in the PowerShell terminal like the previous steps.

### **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.

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-43ee824b503f37a00c5f382a994ceab10b74c243%2Fimage.png?alt=media" 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%2Fgit-blob-7e804b0091b1a16b79ae0a2a9ecd0299cf96e622%2F7.6.png?alt=media" 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%2Fgit-blob-1f75591c73d52e5cfe88da419e68446d621feb3b%2F7.7.png?alt=media" 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:**

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%2Fgit-blob-2fe8962bda9be3fa4e8783e9717128defa97b028%2F7.8.png?alt=media" 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%2Fgit-blob-efdc5a9353cd3d697668f66f3afe43ac27c6da95%2F7.9.png?alt=media" 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.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-a4884e48a58003197dcb488f2a94be9f6da951f0%2F8.0.png?alt=media" alt=""><figcaption></figcaption></figure>
4. Click on the application's name to access its details page.
5. Copy the object ID from the **Object ID** field displayed on the application details page, as shown below.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-34d6e7eb0f77d80ae82b2d5a034dbc4939aea018%2F8.1.png?alt=media" 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%2Fgit-blob-cf2b7a01febce009c44f4993c3dad6c39abb3cc7%2F8.2.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Enter your service principal client secret**

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%2Fgit-blob-43ee824b503f37a00c5f382a994ceab10b74c243%2Fimage.png?alt=media" 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.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-9045feac610016853f826057f6240a00c1c01225%2F7.6.png?alt=media" alt=""><figcaption></figcaption></figure>
3. Click on the application's name to access its details page.
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%2Fgit-blob-c1e705673a20603589f494a20ee918a5e816a880%2F8.3.png?alt=media" 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%2Fgit-blob-86bd5e05538ee65fd924be222489db058a7da7f0%2F8.4.png?alt=media" 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%2Fgit-blob-133e3cacfbe3a2b829561aa2c50152b9f6b0db01%2F8.5.png?alt=media" 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%2Fgit-blob-d75723b48dd9a81a13963a840a5366aff1a5734d%2F8.6.png?alt=media" 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 %}

### **Enter Email Client**

1. Email Client must be either **SMTP** or **SendGrid**.
2. If you enter **SMTP**, you will be prompted to enter the **Email Password**.
3. If you enter **SendGrid**, you will be prompted to enter the **SendGrid API Key**.

**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 (If email client is SMTP)**

Provide the password for the email address provided in the previous step.

**Enter the SendGrid API key (If email client is SendGrid)**

Provide the SendGrid API key.

### **Enter Deployment password**

1. This password is from UI Web App(App Service->Deployment Center->Application scope Password)

## **Enter Capacity resource group**

1. Enter the name of the resource group in which the capacity is present. This resource group name will be used for capacity.

## Initial post-deployment steps

Entering the gpt model name prompted in the previous step completes the deployment process and prompts a menu to appear:

<figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-c2dae571432cb179724e2f34bb79d067d400fefe%2F10.3.png?alt=media" 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.
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%2Fgit-blob-bdd7d078375d1813862337741f99e40c090dd93a%2F14.3%20(2).png?alt=media" 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%2Fgit-blob-783dca57bf83801eeaa90c9005d1a12edbe99e29%2F14.4.png?alt=media" alt=""><figcaption></figcaption></figure>
4. Select the SQL server deployed with the application's name.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-a23fc58ea7cdb0499d4a34faa2bb405f0454d6e2%2F13.4%20(2).png?alt=media" alt=""><figcaption></figcaption></figure>
5. Select **Networking** (under Security) from the left pane.
6. Click on **Add a firewall rule**.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-f59bb29ef83e145f998156e09094ee2c785c369d%2F13.4.png?alt=media" 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.

   <figure><img src="https://2643060172-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIwWVFb1sEdUq6IwVu5D2%2Fuploads%2Fgit-blob-579bb4faba058f440862c9be100acb9b7ede1873%2F13.5.png?alt=media" alt=""><figcaption></figcaption></figure>

{% endhint %}

This completes the deployment process.\\
