How to compare two app services settings in azure - azure

How can I compare the App Service configuration settings in two different App Services?

You can use the Azure Resource Explorer to navigate to and view a JSON representation of the conifguration of an App Service. This is built into Azure and doesn't require additional tooling.
For a Proof-of-Concept application I have, I navigated it as such:
subscriptions
-> My Subscription
-> resourceGroups
-> My PoC Apps
-> providers
-> Microsoft.Web
-> sites
-> MyTestApp
-> config (click on config for some, expand it and browse children for other config)`
I'm assuming you know how to compare two different blocks of JSON via various means (DIFF tools, etc), so I won't explain that part.

You can you PowerShell to get all the configuration details of your app services
Login to your Azure Subscription using Login-AzureRmAccount
To get all Configuration Settings execute below command.
Get-AzureRmWebApp -Name YourAppServiceName1;Get-AzureRmWebApp -Name YourAppServiceName2

Related

App service name in Azure DevOps shows No Results Found

I selected the Azure Subscription that matches the Subscription ID from my app service in Azure Portal, but I keep getting this message No Results Found when I try to select an App Service Name.
Please check if you Service connection is not limited to resource group. For instace this one is:
To check this please go to: Project Settings -> Service Connections -> end edit connection to see details.
Resource group should be empty if your choice is to do not limit connection to particular resource group.
So my guess is that your connection is limited to resource group which doesnt have app service.
I would suggest you to please check the App type i.e., webapp you created on window, or some other OS based on select the App type. I created my web app on Windows OS and can be able to see the app service name populating over here.
Search for the Task : AZURE APP SERVICE DEPLOY

In terraform how to set a new path mapping for an app service in azure?

In azure when i go to an App Service -> Settings -> Configuration -> Path mappings i see the following:
Now let's suppose i want to add more path mappings to it how can i do it, without using App service slots, how can we implement something like this with terraform?
example of what i pretend:
I found an github answer from the terraform providers that involved an azure template deploy using App Service Slots.
https://github.com/terraform-providers/terraform-provider-azurerm/issues/1422
Anyone found a way of doing this?
It looks like this is not yet possible in Terraform. According to this post on GitHub, you can add more path mappings via a PowerShell script once Terraform has finished provisioning its resources.

ARM Microsoft.Web/sites "kind" Possible Values

Does anyone know what the possible values are for kind on a Microsoft.Web/sites object in an Azure Resource Manager template?
There is no indication what the valid values are, only that it is a string.
https://learn.microsoft.com/en-us/azure/templates/microsoft.web/2019-08-01/sites
There are five possible values, they are api, app, app,linux, functionapp, functionapp,linux.
Meaning:
api - api app
app - windows web app
app,linux - linux web app
functionapp - windows function app
functionapp,linux - linux function app
You could easily check it in the portal -> App Services -> Add filter -> Kind.
If you are curious, you can also create one and check it in the resource explorer, it will be like below.

Deploying an Azure Web App through Jenkins

I am trying to deploy an Azure Web App through a Jenkins scripted pipeline using the Azure App Service Plugin. This is my deploy-command (GUIDs have been changed):
azureWebAppPublish azureCredentialsId: 'a0774bb6-e471-47s9-92dc-5aa7b4t683e8', resourceGroup: 'my-demo-app', appName: 'MY-DEMO-APP', filePath: 'public/*, package.json'
When running the script I get the following error:
The client '03a1b3f9-a6fb-48bd-b016-4e37ec712f14' with object id '03a1b3f9-a6fb-48bd-b016-4e37ec712f14' does not have authorization to perform action 'Microsoft.Web/sites/read' over scope '/subscriptions/81fd39sw-3d28-454c-bc78-abag45r5d4d4/resourceGroups/my-demo-app/providers/Microsoft.Web/sites/MY-DEMO-APP' or the scope is invalid. If access was recently granted, please refresh your credentials.
The strange thing is, the ID of this "client" that's missing authorization does not appear anywhere in the build plan. It's neither the ID or a part of the service principal nor the ID of the Container Registry credentials. It also doesn't appear on the machine that executes the build (I checked both the GUID of the mother board and the windows installation). Also the term client is not used for any part of the build plan, so I don't really know what's the actual issue in this case.
Please check out this tutorial that explains how to Set up continuous integration and deployment to Azure App Service with Jenkins and One of the best method to deploy to Azure Web App (Windows) from Jenkins : https://learn.microsoft.com/en-us/azure/jenkins/java-deploy-webapp-tutorial
To find the Azure AD user with the object id '03a1b3f9-a6fb-48bd-b016-4e37ec712f14', go to Azure portal, open Cloud Shell and run
Get-AzureADUser -ObjectId '03a1b3f9-a6fb-48bd-b016-4e37ec712f14'
To diagnose or troubleshoot the issue, go to Azure Portal -> Resource Groups -> my-demo-app -> MY-DEMO-APP -> Access control (IAM) -> Role assignments -> and then search for above found AD User and check if that user has atleast read permission.
Hope this helps!

How can I view the final appSettings values on an Azure App Service web app?

I have an ASP.NET MVC app deployed to Microsoft Azure App Service and am having some trouble with the appSettings and connectionStrings values.
I have some values set in the web.config and some values overriding them in the Application Settings tab of the App Service. I want to quickly and easily view the final values to check that the settings are being picked up correctly.
How can I do this?
Note: I've tried using az webapp config appsettings list but this only seems to bring back what is configured in the Application Settings of the App Service and not the merged results of combining with web.config.
No Azure API will return values that include settings that come from your web.config file.
The only way to get this is to ask the config system within your own runtime. e.g. Use code along these lines:
foreach (string name in ConfigurationManager.AppSettings)
{
string val = ConfigurationManager.AppSettings[name];
...
}
foreach (ConnectionStringSettings settings in ConfigurationManager.ConnectionStrings)
{
string connStr = settings.ConnectionString;
string provider = settings.ProviderName;
...
}
This will give you the effective values that are applied to your app.
You may also use the following blades in Azure Portal (under Development Tools section):
Console
In order to see the file, you may use type command, e.g.:
type web.config
Advanced Tools
This points to the Kudu service.
You may see files deployed when navigating to Debug Console > Choose either CMD or PowerShell. Then navigate to your config directory (e.g. site/wwwroot) and choose to either download or edit file.
App Service Editor
App Service Editor is a relatively new tool in Azure toolset. Default view is a list of files, so you can browse all hosted files, including configuration ones.
You can view all of your runtime appSettings, connection strings and environment variables (and more..) using azure KUDU SCM. if your application address is "https://app_name.azurewebsites.net" you can access it in the address "https://app_name.scm.azurewebsites.net" or from azure portal
With kudo REST API, you can get the settings, delete or post them in this address https://app_name.scm.azurewebsites.net/api/settings
kudo wiki

Resources