# Azure App Service

Azure App Service is an Azure service where you can easily deploy web applications using docker images. This is the fastest way to deploy the integration API if your SQL instance can be available to the Azure IP Range.

## Prerequisites

1. Request the Registry Password in your Power Omni support channel. You will need to provide it
2. Prepare the connection string for your SQL Instance

```
Server=address,port;Database=DatabaseName;User Id=LoginName;Password=ReplaceWithAStrongPassword
```

### Step by Step

To start the process,[ click this link](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fsoupowertuning%2Fpower-omni%2Frefs%2Fheads%2Fmain%2Fintegracoes%2Fmssql%2Fazdeploy.json), which will open a form in your Azure portal.

Fill in the fields: Subscription, Resource Group, Connection String and Registry Password with the information you prepared in the prerequisite.

<figure><img src="/files/xuPjYc0Ca8FuArRBVqt6" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="223">Field</th><th>Guidance</th></tr></thead><tbody><tr><td>Subscription</td><td>Choose the subscription where you will create the resource</td></tr><tr><td>Resource Group</td><td>Choose in which resource group you will create the App Service. You can choose the same one where you installed Power Omni (usually contains poweromni in the name)</td></tr><tr><td>Connection String</td><td><p>Enter the Connection String as prepared in the prerequisites. You can change it later if needed. If the instance is not ready yet, there is no problem. </p><p>You can fill the connection string with the values you plan to create in SQL or leave them blank to change later</p></td></tr><tr><td>Registry Password</td><td>This is a token so that you can download the image created by Power Tuning. Request it in your support channel</td></tr></tbody></table>

The other fields can be left as they are. Change them only if you understand what you are doing or under guidance from the Power Omni team.

Then click Review + Create, and then click the Create button.

{% hint style="success" %}
By default, the cheapest Azure plan is used. Check prices here:\
<https://azure.microsoft.com/en-us/pricing/details/app-service/linux/>
{% endhint %}

<figure><img src="/files/emtJhR3PGqLJ1Nl9nbPn" alt=""><figcaption></figcaption></figure>

Azure will perform some validations when you click this button. If any error is returned, you should contact the administrator of your Azure account or your partner to help resolve it.

{% hint style="success" %}
[Azure Brasil ](https://www.azurebrasil.cloud/)provides exclusive services that can help you configure and solve problems in your Azure account, in addition to obtaining special pricing on subscriptions.

If you need support with your Azure, contact the omni support channel and we can connect you with the Azure Brasil team.
{% endhint %}

If there were no validation errors, the process will continue and should be completed in a few minutes. Just wait.

When it is completed, you will see a screen similar to this:

<figure><img src="/files/9i0MBkj3hiEwBiBdcwDG" alt=""><figcaption></figcaption></figure>

Click on "Deployment Details", and click on the link referring to the resource of type Microsoft.Web/sites:

<figure><img src="/files/RjGFGpJcuerGlaewMrsc" alt=""><figcaption></figcaption></figure>

This will take you to the main page of your App Service. At this moment, it should be trying to download the docker image from the Power Tuning registry. To check the progress, go to the side menu, Settings -> Instances:

<figure><img src="/files/ruF5OHg0cRiOAEICEn2i" alt=""><figcaption></figcaption></figure>

If everything went well, you will see a screen similar to this:

<figure><img src="/files/QGdze19b5JQLHxxKxvQL" alt=""><figcaption></figcaption></figure>

If errors occurred, you will see them in the status columns. The most likely error is that the token you provided may be incorrect (expired, pasted with extra characters such as a space or line break, etc.). If you have problems here, contact Power Omni support.

Accessing the overview screen, you will be able to obtain the URL of your API. Click on it to check if the deployment has already been completed:

<figure><img src="/files/xXnm1phj1W07Po9Yo5w3" alt=""><figcaption></figcaption></figure>

In the example above, the url is:\
<https://poweromni-sql-7db5twmqfrol4.azurewebsites.net/>

Just click on it, and a new browser window should open with the message "Unauthorized!"

<figure><img src="/files/ctdGNqiOLmhGBGr7jChm" alt=""><figcaption></figcaption></figure>

This indicates that the installation was successful, and you are receiving this message because you did not provide any API KEY.

If "Unauthorized" appears, it means the deployment was successful. If it takes too long to load or another error appears other than the authorization message, it may still be deploying or an error may have occurred. You can try debugging through the App Service logs or request support from Power Omni.

### Settings

If you received the unauthorized message, it means the service started and you need to provide the ApiKeys. They were randomly generated during deployment, and you will find them by going to your App Service -> Settings -> Environment Variables.

<figure><img src="/files/QOjAPXRddApjlgbkrwFG" alt=""><figcaption><p>You can click on "Show value" to see the value.</p></figcaption></figure>

This is where your App Service settings are located.

* The env KEYS contains the list of generated keys. By default, 4 keys are generated, each separated by a semicolon. Choose one of them to use as a test, and access the url passing https\:/../apikey=ChosenApiKey.

  <figure><img src="/files/rTwum98Snb8utckOlaBl" alt=""><figcaption><p>Example of randomly created keys</p></figcaption></figure>

  * If you passed the correct api key, the unauthorized error message will change, and a text "working" with a version number will be returned.

  <figure><img src="/files/aVouRfScRYG73u85qjEb" alt=""><figcaption></figcaption></figure>
* The env SQL\_CONNECTION contains the connection string to your SQL Server. If you need to change anything, just adjust it here.

<figure><img src="/files/Qz9LKJkRQTWcslNdFJb6" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}

### IMPORTANT: NEVER SHARE THESE SETTINGS

These data that you provided or that were generated are sensitive. They are data that only your application or PowerOmni should have access to (you configure the apikey when configuring the connector in PowerOmni).

So never share as shown in the screenshots above.

For this guide, the sharing was done, but that app service created was for testing and no longer exists. In your case, since it will be used in production, you must never do something similar.
{% endhint %}

You can change any of these variables at any time (this will cause a restart of your web app, and may cause occasional errors in omni if it tries to invoke while it is restarting).

To view the logs of your app, go to Log Stream:

<figure><img src="/files/LlAdq9p5UQyUgA2CmSXN" alt=""><figcaption></figcaption></figure>

In this log you can access all logs that this integration API generates, including errors. If any user is having problems with responses, such as errors occurring in the database or connecting to it, this log can be very helpful!

In any case, if you have difficulties, contact Power Omni support!

### Firewall Rules with SQL Server

It is common that you need to limit the connection to your SQL Server through firewall rules. If you need to allow an IP range, you can obtain the list of IPs from which your App Service exits using the menu Settings -> Networking

<figure><img src="/files/tqbEAfrPjeMYaTlkXfp7" alt=""><figcaption></figcaption></figure>

On the right side of this screen, you will have the list of addresses that need to be allowed, because the connection with your SQL instance can exit through any of them. Click on "Show more" to see the complete list.

If you need to further isolate IP numbers, you will need to make more advanced network configurations with your App Service. Contact your Azure security team to help you. If you do not have one, you can request consulting from the Azure Brasil team, which is a partner of Power Tuning. Just request it in your support group and we will connect you.

### Next steps

Now that you already know how to obtain the URL of your API and the APIKEY, you can proceed with the configuration in Power Omni!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.poweromni.ai/en/integrations/sql-server/api-deploy/azure-app-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
