> For the complete documentation index, see [llms.txt](https://docs.mrlooquer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mrlooquer.com/integrations/mrlooquer-azure.md).

# MrLooquer Azure

## Steps and requirements

Steps to configure and integrate your Azure account with MrLooquer:

1. Create a Function App
2. Deploy code in your Function App
3. Get keys and configure environment variables
4. Create Alert in Monitor

You need to have a MrLooquer account <https://auth.mrlooquer.com/&#x20>;

### Create function app:

Go to function-app [section](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Web%2Fsites/kind/functionapp) in Azure and add new function app

![](https://lh6.googleusercontent.com/zduiZhbrjau1DGmVvYAtMzxvAdRFz3w4104B_y397o73AlYUZxKngBS7aDR_0h3pIM1jh2MTXFV4hZ1Sy5y7k3lIChSndGQPKvmCJa1e-EuofO0pzUtkm9EuTuIBFuNJWWoz4g1t)

Now, you can choose to deploy the function using docker image o deploying the source code.

{% tabs %}
{% tab title="Docker image" %}
Set the OS to Linux and Publish to Docker Image

![](/files/-LdUSUyFFR_IXwm27Zzz)

Click on "Configure container" to select the docker image.

![](/files/-LdUSurJ7XX8SGbu719x)

Click on "Docker Hub"

![](/files/-LdUTHYXqi953YAp0Fgq)

And complete the 'Image and optional tag' field with: **mrlooquer/rating-azure-function:1.0.0**

Click on "Apply" changes and after, click on "Create" and your function is already created

Copy the function's url because you need it later

![](/files/-LdUVagFKkUyLGkQAfA8)

{% endtab %}

{% tab title="Source code" %}
Set the stack language to Javascript and the OS to Windows

![](https://lh6.googleusercontent.com/DrvgSf4b2-Ld3la9shEgCWQ4AyzE0j3_24KxyWlEMvDq2cGERFvXf9FoZM8eQYB-Ik-5LyoQfxkpLiYEiVC-U6yt8vMv21ldNVk6ssyfP66WDNsABBZmPjhkVUpoqlghUQf-NI_y)

Click on "Create" and your function is already created

![](https://lh6.googleusercontent.com/oMb5QoaEmwBWJZLmabexDcylEbiozrAzxxDEVGfCiMXG5wzO_Fu_4avoyE0sCQpBi_qdYygVoHCQCrws1fsIlnfzD_sNV5QPJmqwgKzboEO6JMHUKkOg4zEn2hjY_mlBUO6SPSJz)

### Deploy code in your Function App

Deploy function in azure:

```
npm install -g azure-functions-core-tools
```

Clone MrLooquer repository

```
git clone https://github.com/mrlooquer/mrlooquer-rating-azure
```

Install libraries

```
npm install
```

In the directory of the code, execute the next command: (replace \<nameFunctionApp> for the name of you functionApp)

```
func azure functionapp publish <nameFunctionApp>
```

![](https://lh6.googleusercontent.com/P4lhDx1kOOJd5qAUu_rgKx1n1iOnv6fAEqhvznpfsELODlwL75TRAIq2do4MeppMiJKnrD-8pi-L2GmS3q7hmYG4nT5MoUBtN3VH44CToVF-2srdJZdtaAhitCtKkWpQQ7xVr96P)

###

{% endtab %}
{% endtabs %}

###

### Get keys and configure environment variables

#### Get Azure keys

Install Azure cli

```
curl -L https://aka.ms/InstallAzureCli | bash
```

Login on Azure cli

```
az login
```

Set subscription id

```
az account set --subscription "subsId"
```

Create keys

```
az ad sp create-for-rbac -n "name"
```

#### Get MrLooquer Keys

Login on [MrLooquer Rating](https://auth.mrlooquer.com/) and go to "Settings" menu. Set a name and get the token.

![](/files/-Ld3ENjbbdP9_06g2TMx)

#### Configure environment variables in function

![](https://lh4.googleusercontent.com/G7m50sYKLhwPyIelyxiZ1yuzk0gdxMokTZWrX2ykM0FRBkYtsTGaHeJfnCTCoBtLMBd0Q0-d0Clk6nYwUAEMvQ6h3RMEtKo5fMHdm18YGbdow_JZw1pHdEcCXTukVtAwIz1_Bp1R)

![](https://lh5.googleusercontent.com/kXJjqUC-vw20FdNSImzKB8bU46tL0-q6VdMjR_XEa6bYLSCGjj9S9X_XHK4IGqHgfrK8Y3W9WXzuoMBZ5Lim9tWlMXnM8cjGzVStTdd6F-AsRhSo5LF18hub8OHU1Uj4GMsg_Y-Z)

Go to application settings

![](https://lh3.googleusercontent.com/zQOgdHyVe4wjWR4txEIbpbn-nG5o8JjyzyCJKti5oae54EdZrjNmpJlBjhCT7fkq6H7iqG8ywJ7CtNnzKfoauFGRqLE8xzXLYuZkvo0gwNkE7CbcpRZKZciHh-w5SuKF3vMiFkDF)

Now configure the next environment variables:

> AzureWebJobsSecretStorageType =  Files
>
> API\_TOKEN -> [Token](https://docs.mrlooquer.com/integrations/mrlooquer-azure#get-mrlooquer-keys) obtained from MrLooquer Rating
>
> RESOURCE = <https://management.azure.com/>
>
> CLIENT\_ID -> appId value obtained in the credentials azure step
>
> CLIENT\_SECRET -> password value obtained in the credentials azure step
>
> TENANT\_ID = Tenant value obtained in the credential azure step

### Create Alert in monitor

Go to [monitor page](https://portal.azure.com/#blade/Microsoft_Azure_Monitoring/AzureMonitoringBrowseBlade/overview) and click on "Alerts"

![](https://lh4.googleusercontent.com/UXT7CKzKUnngtmm5iMvA07UOQFp6_eqdPy59oWKSIjYw_kD3T0C-epMatC9QeLYJS54Bp6mf6m6Q0AEPdwCxlY5FfXE58OUB8hXSM5iNY10-jl7EsWX0vcckEkssIiktJylJ6IAX)

Create a new Alert Rule

![](https://lh3.googleusercontent.com/5D0_Y8ELX8jRV2kurbpW-gc5mzdW-bO2-oYnQqdFPbqx93i3CaSRWUt7BCNCFZUBHQs6xHaeiEVBfBM6Jaj6DmMWfMjVYyCtdSbC0DpU7RNhZeR5fSHo-pQtIFvweDAIARRwnvNF)

Select subscription

![](https://lh6.googleusercontent.com/zUN6iOUiK8mxMMMhe_2Ea4gd0lJBY31fwu9WAtNF-VLuYEGrHmtdI9jejUODf9KeKDJirWSmd4mYk8r_jgJWM4MZpphzo7-uyPLrB9wxnqMf1b7X4Moe3weT1_s538yJ6tqsYE4C)

Choose the following conditions

> Signal Name: All Administrative operations

![](https://lh4.googleusercontent.com/vLyW7pMjh3TC5iaYNwtwkGNzQic7eK6bG2g_dpWx-hJnZ2Tqw1ngeJFx3CI9T3KgddZp4T-RW2N7DozNuZ_7FpESQjoL51PC2vY2VJUOS90E5479GVkBWrGXxPSjJUgWz14S9yZd)

> Level event: Informative

![](https://lh6.googleusercontent.com/1ZATYKfKGFWFKPye7VizGBu4l9pSU_GbH4JXSvvv6o5DZisT7afAeKnFmoHHAgGBg6SaJqzDLlYzNyhhW2KPObCaaPxtqn68QNydFyUXYiLwURjdyoFCk2TT1aL8SGq-1PdnwjE1)

Depends on the method that you used to create the function, select the next step:

{% tabs %}
{% tab title="Docker image" %}
If you created it the function with docker image, continue with these steps:

Create a new Action Group and select "Webhook" as the type of action and complete the url field with the next value:

\<url>/api/HttpTrigger

Replace \<url> for the url that you copied in the last step on the "create function app" section.

![](/files/-LdUXEbzeNq7pyl6yvSe)

Click on "Accept".

![](/files/-LdUY_lnCJlLe7PQkufI)

Click on "Accept" again.
{% endtab %}

{% tab title="Source code" %}
If you created it the function with source code, continue with these steps:

Create a new Action Group and select "Azure Functions" as the type of action and select the function we created in previous step

![](https://lh6.googleusercontent.com/ybpzntSugnMrM-z00mSnL91Iz1fTmwkbCoSRueKxVr3eclyL-UItgTrRHsorUdHX73bfZcxHoWff3TdrP9P70xXTMR1DCT3Y12727JxhqpOI62IepOgT98hFqnkgun5fV6wmpXIf)

Click on "Accept".

![](https://lh5.googleusercontent.com/lf6qhfCwFr2TZA_tEPu-mXGMBhWk6pd6-Nkuzupe-9Coj3pljD4L9Ys2nMihF-JGExOsXr6M16m0W-ATO6-Lt29yCDFngfUrtX-g1Q-d87bRn6MyMgMtKKs3vD5_uxI0HkbnOfC-)

Click on "Accept" again.
{% endtab %}
{% endtabs %}

Click on "Create" and you are done!
