Azure PowerShell - Request to a downlevel service failed


Azure PowerShell - Request to a downlevel service failed


Issue:
·       Sometime when we run the PowerShell command, we get following error message,
o   Request to a downlevel service failed
·       Example: Switch-AzureWebsiteSlot

Solution:

The reason for error message “Request to a downlevel service failed” is Deprecating Service Management APIs.

Issue was happening because your CmdLets are using the Service Management API which is deprecated for Azure App Service.

You can get more information on below URLs,

To resolve this, You should implement the ARM equivalent.

Your command should have “RM” e.g. Switch-AzureRmWebAppSlot instead of
Switch-AzureWebsiteSlot

I hope this helps.

Azure Functions: Invalid Length for a Base-64 char array or string


Azure Functions: Invalid Length for a Base-64 char array or string


Issue:
·       My function is throwing error - Invalid Length for a Base-64 char array or string
·       My function is using Storage Queue trigger/binding

Solution:

This issue happens when you have storage queue trigger function.
When you send message to storage queue, it expects you to send in base64 encoded string.
Functions expect a base64 encoded string. Any adjustments to the encoding type (in order to prepare data as a base64 encoded string) need to be implemented in the calling service.
This can also be seen on portal when you send message to queue manually.

Invalid Length for a Base-64 char array or string



You should send message in Base64 format.
For example, if you have JavaScript function then you can use btoa module for converting your message to base64 format.


Your function exception will disappear once you send message in base64 format.
I hope this helps.

Azure web App remote debugging | Unable to connect to the Microsoft Visual Studio Remote Debugger(MSVSMON.EXE)

Azure web App remote debugging

Unable to connect to the Microsoft Visual Studio Remote Debugger (MSVSMON.EXE)



Issue:
System.Runtime.InteropServices.COMException (0x89710023): Unable to connect to the Microsoft Visual Studio Remote Debugger named XYZ.azurewebsites.net'.  The Visual Studio 2015 Remote Debugger (MSVSMON.EXE) does not appear to be running on the remote computer. This may be because a firewall is preventing communication to the remote computer. Please see Help for assistance on configuring remote debugging.at Microsoft.VisualStudio.Debugger.Interop.Internal.IDebuggerInternal120.ConnectToServer(String   szServerName, VsDebugRemoteConnectOptions[] pConnectOptions, CONNECT_REASON ConnectReason, Int32 fIncrementUsageCount, IDebugCoreServer3& ppServer)

Solution:

·       This exception is related to MSVSMON.EXE
·       This exe should be running to perform remote debugging.
·       We can verify this exe in kudu site-> Process Explorer
·       Once we enable remote debugging setting,



·       Please verify whether this EXE is running or not before performing remote debugging.
·       If you see this exe and still not able to remote debug then
o   kill that exe.
o   Disable remote debugging setting
o   Enable remote debugging setting
o   Verify that exe is running.
o   Restart web app if needed.

·       The exception message is also indicating about firewall setting.
·       To enable remote debugging for Visual Studio the port number 4020 should be open.



I hope this helps.

Azure | How to Migrate from Consumption Plan to App Service Plan


Change Function app hosting plan


How to Migrate from Consumption Plan to App Service Plan


How to Migrate from Consumption Plan to Premium Plan

Issue:

  • I want to change my consumption plan to app service plan.
  • I want to change my app service plan to consumption plan.
  • Is there any way to change Azure function hosting plans?

Solution:

Azure Functions is a popular serverless computing platform that allows developers to write and run event-driven functions in the cloud. Azure Functions hosting plan migration refers to the process of moving your Azure Functions from one hosting plan to another. In this blog, we will explore the reasons for hosting plan migration, the different types of hosting plans available, and the steps involved in migrating your Azure Functions to a new hosting plan.

Reasons for Hosting Plan Migration,

There are several reasons why you may want to migrate your Azure Functions to a new hosting plan. Some common reasons include:

  • Performance: If you're experiencing performance issues with your current hosting plan, you may want to migrate to a higher-performance plan to improve the speed and reliability of your functions.
  • Cost: If you're looking to save costs on your Azure Functions, you may want to migrate to a lower-cost hosting plan.
  • Scaling: If you're expecting increased traffic or usage for your Azure Functions, you may want to migrate to a hosting plan that supports higher scalability.

There are 3 types of hosting plan available from function app,

  • Consumption plan
  • Dedicated App service plan
  • Premium plan

Each plan has its own advantage and limitation. You should choose it carefully. 

You may see lot of articles and blog which suggest you can change function app hosting plan from consumption to dedicated App Service plan and you will be able to achieve that also, but according to Microsoft recommendation, You should never do thisYour function app will be messed up and you will see a lot of issues. 

This has been mentioned on Microsoft Official documentation. 

You can switch between Consumption and Premium plans by changing the plan property of the function app resource.

But You can't change consumption plan to Dedicated App Service plan or vice versa. 

Ref: https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale  

Now we know we can migrate consumption to App service plan hence we should focus on, how to achieve it.

Steps to change function app from consumption to premium,

  • Create the premium plan.
  • Then update the plan property of the function app so it no longer points to the consumption plan but the premium one.
  • This feature is not available in UI right now
  • You can use CLI command for this,

az functionapp update --name MyFunctionApp --plan <plan name or plan-resource-id>”

 

CLI Ref: https://docs.microsoft.com/en-us/cli/azure/functionapp?view=azure-cli-latest#az-functionapp-update

The premium plan is supported in some regions only. you can get the list of regions in the below URL if you face any region issue.

https://docs.microsoft.com/en-us/azure/azure-functions/functions-premium-plan#regions

 I observed some limitation as of now e.g. It only worked when,

  • Both plans are in the same region.
  • Both plans are in the same resource group.

More info : https://github.com/Azure/Azure-Functions/issues/1194 

For the dedicated app service plan, the only option is: You should create a new function app in different hosting plan and update/deploy your code.  

Please don’t try to change function app hosting plan from consumption to Dedicated App Service plan or vice versa. This may be possible in future but not now. 

Hope this helps. Please let me know in comment section  if you have any query.
Happy to help you :)

Migrating your Azure Functions to a new hosting plan can help improve the performance, scalability, and cost-effectiveness of your serverless applications. By understanding the reasons for hosting plan migration, the different types of hosting plans available, and the steps involved in migrating your Azure Functions, you can make an informed decision about the best hosting plan for your specific needs. Whether you choose the Consumption Plan or the App Service Plan, Azure Functions provides a flexible and powerful platform for building and deploying event-driven serverless functions.


Other useful references,

Issue: Azure function is throwing one of the following exceptions
·       Unable to retrieve Functions Keys
·       We are not able to retrieve the keys for function
·       The function runtime is unable to start.
·       Function host is not running.
·       Internal Server error.
·       Service Unavailable.


Issue: Azure Functions: The Consumption pricing tier is not allowed in this resource group



Issue: Disable Azure functions