Enabling HTTP/2 on Azure - azure

My Azure hosted Web Site has the following configuration (see image).
So I believe I have enabled HTTP/2.
However, when I access it from Edge/Chrome and in the Development options choose "Report". I get (see image):
IGNORE the "localhost" bit. I took the screen capture from my local copy, but I get the same when I run the report on my Azure version of the site.
Why is it saying http/1.1?

Double check in the resource explorer if http2enabled is set to true. Go to:
Subscription > Resource Group > your site name > Providers > Microsoft.Web > sites > your site name > config > web
then select PUT
source: https://azure.microsoft.com/en-us/blog/announcing-http-2-support-in-azure-app-service/

Related

App Service health check is 0% even when in browser website returns 200

I have enabled health check with path "/" for App Service slot.
This path in browser and using curl return 200 status code.
But App Service health check status displays 0.00% (Healthy 0 / Degraded 1)
How is this possible?
Just to highlight that if your application depends on a database and a messaging system, the Health check endpoint should connect to those components. If the application can't connect to a critical component, then the path should return a 500-level response code to indicate the app is unhealthy. See: Monitor App Service instances using Health check
Also: Please confirm to make sure that your health check path was added successfully:
From Azure Portal:
To enable Health check, browse to the Azure portal and select your App
Service app.
Under Monitoring, select Health check.
Select Enable and provide a valid URL path on your application, such as
/health or /api/health.
Select Save.
From Resource url:
You may use the following URL: https://resources.azure.com/ to check that you added the path correctly in your web application.
Follow the steps here:
Go to https://resources.azure.com/
Expand your subscription > Go to Resource Groups > Select the Resource
Group where the app service is hosted.
The select providers > Then select Microsoft Web > Open sites And open your
app service > Then open config > And lastly web.
You will need to scroll to the bottom to find the variable called
‘healthCheckPath’ and you will see the value there for the path you set in
the portal.
Also refer to this detailed document on Health check here might be helpful: https://learn.microsoft.com/en-us/azure/app-service/monitor-instances-health-check?tabs=dotnet#frequently-asked-questions
Addition:
Using curl to the heatlhCheckPath in the case of multiple running instances could be misleading as you might not receive status of each running instance of the app and might get result for random instance the load balancer directs to you.
Suggest you to fetch the values of Health Check Status metric by using the Azure CLI.
az monitor metrics list --resource myresource --resource-group myresourcegroup --resource-type "Microsoft.Web/sites" --metric "HealthCheckStatus" --interval 5m
Also please Note that the --interval property is important as health checks do not support the default 1m interval used by az monitor metrics list

Azure-alert: Unable to create azure alert in gov subscription

Call the api to create an alert in Gov subscription:
ret = await HttpHelper.PutAsync(
new Uri($"https://{app.AzureManagementBaseUri}/subscriptions/{alert["SubscriptionId"]}/" +
$"resourcegroups/{alert["ResourceGroupName"]}/providers/microsoft.insights/" +
$"metricAlerts/{alert["Name"]}?api-version=2017-09-01-preview"),
alertJson, app.AccessToken, cancellationToken).ConfigureAwait(false);
But throws an error:
Error: 'Error while calling 'https://management.usgovcloudapi.net/subscriptions/subid/resourcegroups/ctxwsgs-appinsights/providers/microsoft.insights/alertrules/"alertName"'. StatusCode: BadRequest. Response: '{"code":"ResourceNotSupported","message":"The target resource id '/subscriptions/subid/resourceGroups/ not supported."
The same code works fine for others subscriptions, did I missed some configuration in the gov subscription?
This appears to be a known issue with enabling microsoft.insights in Azure Government. The only way to enable Application Insights via the traditional Add Application Insights Telemetry button in Visual Studio requires a small manual workaround. If you do not use this workaround you will get the error you described.
To mitigate the issue, you must perform these steps:
Switch Visual Studio to target the Azure Government cloud.
Create (or if already existing set) the User Environment variable for AzureGraphApiVersion as follows: (To create a User Environment variable go to Control Panel > System > Advanced system settings > Advanced > Environment Variables.)
Variable name: AzureGraphApiVersion Variable value: 2014-04-01
Make the appropriate Application Insights SDK endpoint modifications for either ASP.NET or ASP.NET Core depending on your project type.
Source: https://learn.microsoft.com/en-us/azure/azure-government/documentation-government-services-monitoringandmanagement

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

Connecting to an Azure website via FTP using Azure login credentials

What login credentials do I use to connect to the FTP site that is listed on the dashboard of my Azure?
I tried using the same credentials I use to log into Azure, but this failed.
In the current Azure portal the deployment credentials can be set by going to App Services → select the relevant app service item → in the Deployment section → Deployment Center → FTP → Dashboard. You can either chose to use the preprovided App Credentials or assign User Credentials.
In the previous generation Azure portal the deployment credentials can be set up by going to WEB APPS → select relevant item → DASHBOARD → Reset your deployment credentials.
Make sure you're specifying siteName\userName as your login name. The site name portion is required!
The default directory for the web content is \site\wwwroot which can be set as the initial directory for many FTP clients.
If you want use the default value you need to download the publish profile in your dashboard for your site:
[UPDATE for the new Azure UI]
It will be an XML file. Open it and find your credentials. Sample:
<publishProfile
profileName="nameofyoursite - FTP"
publishMethod="FTP"
publishUrl="ftp://waws-prod-blu-001.ftp.azurewebsites.windows.net/site/wwwroot"
ftpPassiveMode="True"
userName="nameofyoursite\$nameofyoursite"
userPWD="sOmeCrYPTicL00kIngStr1nG"
destinationAppUrl="http://nameofyoursite.azurewebsites.net"
SQLServerDBConnectionString=""
mySQLDBConnectionString=""
hostingProviderForumLink=""
controlPanelLink="http://windows.azure.com">
<databases/>
</publishProfile>
Where your credentials:
publishUrl="ftp://waws-prod-blu-001.ftp.azurewebsites.windows.net/site/wwwroot"
userName="nameofyoursite$nameofyoursite"
userPWD="sOmeCrYPTicL00kIngStr1nG"
Source: Azure Web Sites FTP credentials
Connection from command line on OS X:
Console client:
ftp ftp://nameofyoursite:sOmeCrYPTicL00kIngStr1nG#waws-prod-blu-001.ftp.azurewebsites.windows.net/
Mount from the console:
mkdir /Users/<YOUR_USER>/FTP_AZURE
mount_ftp nameofyoursite:sOmeCrYPTicL00kIngStr1nG#waws-prod-blu-001.ftp.azurewebsites.windows.net/ /Users/<YOUR_USER>/FTP_AZURE
cd /Users/<YOUR_USER>/FTP_AZURE
Open for editing in Vim:
vim ftp://nameofyoursite#waws-prod-blu-001.ftp.azurewebsites.windows.ne//site/wwwroot/
Note the user name here: nameofyoursite, not nameofyoursite$nameofyoursite
To be complete, you can FTP using two different credentials:
It is already mentioned by #0x8BADF00D. If you downloaded the 'publish profile', you can see the automatically generated credentials for each site.
In short, if x=your website name, then username=x\$x and the password is a long system generated string
Obviously, this is not meant for a human user...at least I cannot easily remember a 20+ character random string...
There is a more user friendly way. You can set a username and password in Azure portal
However, "deployment user name" is directly tied to a Microsoft account. It is the same for all your web applications. In order to use it to ftp into different web applications, you need to add a prefix.
Here, my username is "blabla", and my website name is "test" ==> my FTP username is thus "test\blabla" (mind the backslash on Windows) followed by the password I set on Azure portal (no modification required):
Here are the references from Azure:
Why there are two credentials for FTP
How to log in with the user friendly credential
In the Azure portal (end of 2018):
Go to your app
In the left pane, select Deployment Center
In the middle pane, select FTP
Click view dashboard, and there you have your ftps connection url, username and password.
You must enable FTP/S on your web app to actually be able to connect! This is done under Application Settings -> FTP Access in the Azure portal
These two blades give all the required information to connect via FTP.
App Service > Settings > Properties
App Service > Deployment > Deployment Center > Deployment Credentials

Azure cloud deployment fails : Certificate with thumbprint was not found

I am developing a Web API based web service to be hosted on Azure. I am using Azure 1.8 SDK.
When I try to deploy my cloud service, it takes a very long time to upload after which I get an error message which says:
12:09:52 PM - Error: The certificate with thumbprint d22e9de125640c48a4f83de06ae6069f09cfb76c was not found. Http Status Code: BadRequest OperationId: 50daf49111c9487f82f3be09763e7924
12:09:53 PM - Deployment failed with a fatal error
Apparently, the certificate being referred to is related to enabling remote desktop to role instances on the cloud (i am not very sure about this; saw this on the internet for a similar problem). However, I did not check the option to enable remote desktop on the instances while publishing.
What could be going wrong here?
What worked for me was:
Goto powershell and type mmc
Add certificates snap-in by going to File > Add/Remove Snap-in > Choose Certificates from the list > Choose My user Account
Right click on Certificates - Current User and select Find Certificates
On the dialog box, set Contains to 'azure' and Look in Field to 'Issued To'
Press Find Now. You should be able to see a list of certificates.
Check for the thumbprint by double-clicking the certificate > Details tab > scroll down to Thumbprint
Once you found your certificate, close the dialog, Right click and select Export
Select to export the private key. Follow the steps until you have a *pfx file for upload to Azure
Goto your service and select the Certificates tab
Click Upload, select the exported *pfx file, and supply the password you've set during export
Goto Dashbord and update the Cloud package
List item
The certificate used in your project doesn't exist on the cloud environment. Make sure the same certificate used by your project is uploaded to the cloud environment. If you are using Visual Studio then you can fix this error as follows:
Right click your Web Role / Worker Role (under Roles folder in the cloud project) → Properties → Certificates
Click on the ellipsis button under Thumbprint which will point to your certificate.
Upload the certificate which shown here to Windows Azure environment (Production or Staging)
have you uploaded your publishing settings file in visual studio and/or a management certificate? this is crucial to be a trusted point by your azure subscription, hence why you could be having this issue. BTW try upgrading to SDK 2.1 too for better support and better features (if possible of course).
Adding to Arbie's answer. You can avoid the first few steps. Just type "Manage user certificates" in windows search bar. Go to Personal > Certificates.
Your certificates would have Issued to "Windows Azure Tools".
You can check for the thumbprint by opening the certificate and checking the Details.

Resources