Change existing Azure Function's hosting OS from Windows to Linux - azure

Currently we have a Function App in Azure which is hosted in Windows. Initially once you create, you need to choose the hosting environment as below:
Question:
Is there any chance to change the underlying hosting environment for already created Azure Functions? I did not find anything related to that even in the official documentation.
Appreciate the clarification.

Change existing Azure Function's hosting OS from Windows to Linux
In short, it's impossible.
Because of the potential of breaking changes, you can only set the Operating System when you create function.

Related

Azure window server in-place upgrade but plan is still the same

In order to avoid doing some overhead work, I decide to use a work-around to upgrade my VM from server 2016 to 2019. The work around was successful and everything is running fine. One hiccup though is that I still see the plan being set to "2016-Datacenter".
(Correct me if I am wrong) So far doing some digging I see that this is set at the create time of the VM; it corresponds to the sku of the image used to build the VM.
My question is, are there any gotchas if the VM is running server 2019 but the plan is set to "2016-Datacenter"
Plan information is metadata Microsoft uses to track Marketplace offers. If you want to create an image in a shared gallery, using a source that was originally created from an Azure Marketplace image like this, you may need to keep track of purchase plan information. You may face issues when you create a VM from the Azure Marketplace image if there is wrong plan information. Read here for more details.
We are able to do an Azure VM in-place upgrade to Windows Server 2019. Here is the step by step process to update the IaaS VM Windows server to Windows Server 2019 for your reference.
However, it's not recommended to do because Microsoft does not support an upgrade of the operating system of an Azure VM.. It prefers to use a clean uninstallation and installation. To work around this issue, create an Azure VM that's running a supported version of an operating system, and then migrate the workload.

Create virtual machines with Windows Azure php sdk

I am trying to figuring out how to create virtual machines with windows azure php sdk https://github.com/Azure/azure-sdk-for-php , I can't seem to understand on how to do this as there is any mention about virtual machines in the sdk.
Any help will be very apreciated.
Thanks
The Azure-SDK-for-PHP offers Service Management (see https://github.com/Azure/azure-sdk-for-php/blob/master/README.md) to spin up app services or VM’s. I’m not sure if it already includes support for managing Docker containers, but since it’s all REST API in the background, it should not take too much time to write a few lines to have it do the same thing. But for VM’s you can definitely manage them through the SDK.
If you need code samples, ping me. I’d love to share my knowledge.
I think azure-php-sdk is for using azure storage etc. it's not for creating VM.
Normally to create VM throught management portal and Windows azure powershell.

Get azure account information inside virtual machine

I have got a question. Suppose I have a virtual machine running inside my windows azure account.
Now I need to write some c# program(or whatever the language will be) that can give me my account name and virtual machine name on which it is running. Is it possible? If yes then pls tell me how.
Thanks in advance
I believe the only information about Azure environment you can get hold of is whatever Azure REST Management API can provide which implies you have to authenticate first. However, to get the virtual machine name from within the C# app, it's sufficient to use regular .NET fx calls, such as System.Environment.MachineName

How can an Azure website determine which region it is running in?

I will be placing an Azure website, in several regions. Then configuring the Azure Traffic Manager to distribute requests to each region.
The website needs to know which region it is running in. Is there an API available to determine this? Or, is my only choice, to define a REGION app setting, that is set appropriately for each Azure website?
I had the same question today, and found this thread. It seems that Web Apps now do include the promised environment variable showing the region in which they are deployed.
I simply used:
string region = Environment.GetEnvironmentVariable("REGION_NAME");
and it worked fine (note that it returns null when run outside Azure e.g. in Visual Studio).
I got a response, to my question, on the Microsoft Azure DNS and Traffic Manager forum.
The answer was:
There's no handy way currently. In the Azure Powershell, you could use Get-AzureWebsite to read the WebSpace value, which is structured as Region+"webspace".
For now it's easier to just add it to the app setting, like you suggested. We'll have the region value as an environment variable in a later release.
So, as suggested, we will just use an app setting to tell the website what region it is running in. We will switch over, to the environment variable, when it becomes available.

Windows Services in Windows azure

Does windows Azure supports windows Services ?, ...
I develop an application that has among its components a windows service that every hour sends an email with information.
Is this supported in Windows Azure?,
Thanks!!
You might find the worker role is a better fit for running a process every hour. If you have the code for the WIndows Service it should not be hard to impleemnt it in a worker role.
You will, however, have to use a 3rd party service to send the email, as this is not supported in Azure.
Regards,
Alan
Yes, you can do this*. In order to install a Windows Service in a PaaS worker role (or web role), you will need to create a startup script that installs the service on boot (and checks to see if already installed on subsequent boots).
If you are using IaaS VMs, then the installation is straightforward - just do as you do today.
*Windows Azure Websites is a shared model, so installing services is not supported there.
To combine both Alan Smith's and dunnry's answers, both are correct -
You can install a windows services on a PaaS role using a startup script (other than web sites).
If you're using a Virtual Machine you just install the service on the VM
But Alan is completely correct that the best route forward in most cases is migrating the code to a worker role which is usually quite straight forward, would work best and would be easier to maintain.
Having said all of that - sending emails from within Azure is not necessarily a good idea as many mail servers black list the ips (turns out Azure is a great platform for spammers)
I want to make an extra addition to Alan and Yossi's answers. It's important to know the why, because simply installing the Windows Service shouldn't be a problem.
But if you do this you'll be missing out on something very important. If you run all of your code in the actual Worker Role process you'll get the monitoring for free. This means, if your process crashes for whatever reason, Windows Azure will restart the instance to make sure the process gets back online.
Now if you simply go and install a Windows Service through a startup script you won't be able to take advantage from this automated monitoring. You'll need to make sure you have some kind of recovery (this could be a setting on the Windows Service or a different process). But it's simply too much work for something you could get for free.
I would suggest using a Extra-Small VM using a windows template that is already offered. It's the same cost as the worker role and will let you provision your service without any issues. You would install your service the same as you would on any on premises server.
If you don't need to have the same sort of failover scenario that your web roles do then this s a good option.

Resources