Azure App Settings not added to website when using virtual applications - azure

According to the following screenshoot that shows all environment variables for an application and the configured app settings in the azure portal, i get the impression that app settings do not work with virtual applications. Is this intented?

I'm not exactly sure what your left pane image is showing, but App Settings should apply to both the roo app and any virtual apps under it. They are based on environment variables (e.g. foo becomes APPSETTING_foo), which are available throughout the environment.

Related

Deploying azure function from IntelliJ removes all app settings

I'm using Azure IntelliJ Toolkit, to deploy Azure function.
This is the screenshot showing how it is getting deployed:
App Settings here is non-optional, and whatever is inserted here will override anything that already exists in Portal, as shown below:
This seems like serious bug, but wonder if there is any workaround.
Any thoughts?
Created the basic Azure Java Function Http Trigger in IntelliJ IDE and published/deployed to Azure Cloud with the default application settings:
In the Azure Portal > Function App Configuration Menu > Application Settings:
If you remove any application settings from the local IDE IntelliJ and save, the same will be in the Azure Cloud:
If you want to add more application settings, do not remove the existing ones in the IntelliJ Azure Function App Properties Window because that is local Window of the Azure Portal Function App Configuration.
For running the function project locally with the additional configuration, you have to add them in the code file of local.settings.json.

Application Insights Live Metric for Virtual Directory Apps

I have an App Service on azure. It contains 2 web app set in 2 different virtual directory. There is no web app in the root folder. I have configure the Application Insight for both project in Visual Studio and publish each app to their azure virtual directory. But nothing is showing up in Live Metric of the Application Insight of the App Service. All I see is : "Not available: your app is offline or using an older SDK" .
It seems that Application insight could only run on root website.
BTW, the way you set up virtual applications may have some mistakes. You should set as below:
For more details, you could refer to the article-Deploying multiple virtual directories to a single Azure Website.
Also you will have to add the app insights SDK to all the app and be sure you set InstrumentationKey for each as well.
Refer this SO thread for similar kind of issue.

How do you host Strapi within an Azure App Service?

After inheriting a Strapi application hosted on Azure Container Instances, which has proved temperamental.
Given it's on the surface just a Nodejs application we want to move it to an Azure App Service to take advantage of hosting savings and also deployments via slot swapping.
The current documentation for Strapi includes guides for both Azure VM and deploying as a Docker conatainer. However we want to host as code on a windows based app service.
The reason for windows over linux is the time that Zip Deploy or Web Deploy taken when running on the linux version. Also we can run the App in an existing App Service plan.
The question is how to host Strapi on an Azure App Service?
After much trial and error we finally have this up and running, here are the steps that made it successful.
Create the App Service
Create an App Service that publishes "code", has a runtime of Node 14 LTS & has OS of Windows.
Configure the App Service platform
Once created navigate to "Configuration" of the App Service and make sure that WEBSITE_NODE_DEFAULT_VERSION is set to "~14". And on the "General Settings" tab update the platform to "64 bit". This ensures that the "sharp" package that is used by Strapi can run, as it requires 64 bit platform.
After making these changes, navigate to the console and run the command node -p process.arch you should see the result is result is "x64".
Application Settings
Now to configure your application specific settings. For an out of the box Strapi app this is likely to include database configuration and any plugins like mail, identity and storage providers.
For us the crucial part though was the settings to be used by Strapi to startup and host the application.
This include the HOST & PUBLIC_URL settings.
HOST = 0.0.0.0 and PUBLIC_URL = https://{APP_NAME}.azurewebsites.net/ (replace APP_NAME with the name of your app).
Code changes
There are a few changes needed to the out of the box Strapi app that are needed to run on Azure.
Add a web.config to the route of the project. An example can be shown here: https://gist.github.com/bradleyisfluent/1033bb9dc908b2386c5ee09e0b36409f. This utilises IISNode to run server.js as the entry point to the app.
Create a server.js in the root of the project. Contents should look like:
const strapi = require("strapi");
strapi().start();
Modify the current server.js within Strapi config /config/server.js to access the environment variables on the server, like this:
host: process.env.HOST,
port: process.env.PORT || 3000,
n.b of course here, we are simply accessing environment variables and configuration it can be managed in different ways. The crucial thing though is to access the port via process.env.PORT which is implicitly set on the App Service.
Deploy code
This is where we are still a little bit of a work in progress. Utilising Azure Devops pipelines we are building and deploying the application.
It appears that using "Run From Package" feature of Azure App Service doesn't not work for Strapi. My hypothesis is something is trying to write to the wwwroot dir which is read-only in the this setup and this causes an error.
So we are using "webDeploy" which given the size of our built project (218mb, thanks node_modules) means the deployment times are slow. However this only applies to our preview builds as we can use slot swaps to release to Production.
Here is a link to a slightly reducted version of a working azure-pipelines.yml: https://gist.github.com/bradleyisfluent/ffff8c1b6bedd5052274dc0d9f19a91d

Use your local development environment to edit this Function App

For reasons beyond my control we dont yet have a release pipeline for Azure Functions
However, I would like to be able to enable/disable functions on an environment via the portal
This does not seem to be possible
Is there a way around this?
How can I release a version that doesnt have this restriction?
The function app itself was created in the portal then I deployed into it
Use your local development environment to edit this Function App
Here are the steps to Enable/Disable the Function App through Portal
Steps:
Login to portal Azure Portal
Under the Subscription and the resource group go to the Function app created
Click on the App overview where you can able to see the Enable or Disable options.

Programmatically set Azure App Service application settings / environment variables

I have an ASP.NET Core (RC1) app running on Azure App Service. The app takes its configuration from environment variables. I currently use the Azure Portal's 'Application Settings' page to set these environment variables. The app is deployed with Kudu (if this is relevant?)
I would like a way to programmatically set these environment variables so that I don't have to go through the Azure Portal every time I want to create a new environment variable or modify an existing environment variable. Ideally I would like to do this by calling a REST API. Is this possible, and if so, how?
Instead of setting environment variables in the Azure Portal, you could deploy an appsettings.json file along with your app with the desired settings. If you have a build server or deployment server, you could transform the config file with the correct settings for your environment.
If you i.e. are using Octopus Deploy for deployments, you could use the JSON Configuration variables feature to handle this.
http://docs.octopusdeploy.com/display/OD/JSON+Configuration+Variables+Feature

Resources