DISCLAIMER: This post is based on my understanding, which may have gaps or inaccuracies, so as ever your mileage may vary. By all means use this post to learn about the various scenarios for licensing, but ALWAYS check with your Microsoft licensing specialist to ensure you are conforming to legal requirements.
For the purposes of this post, I'm assuming that the Azure Stack in question is dedicated to one customer. Things get a little more complex in a multi-tenanted environment.
There are two ways to license Windows Server in Azure Stack.
• Pay as you Go (PAYG)
• Bring Your Own License (BYOL)
PAYG only has one mechanism for billing - when you spin up a Windows Server in Azure Stack, you'll be billed the consumption rate for Windows Server vCPUs for however many vCPUs that VM has, for the time the VM is running, via the Azure commerce engine. Whether it's Datacenter or Standard, you'll be charged the same, so just use Datacenter.
BYOL is more complex. You may have Windows licenses from any of:
• Enterprise Agreement (EA)
• Open/Select/Volume License
• Service Provider Licensing Agreement (SPLA)
• Cloud Solution Provider (CSP)
• There are others too, but probably not relevant here (e.g. OEM)
Where you're allowed to run these licenses varies as well.
• EA and Open/Select/VL can run in any location
- assuming the hardware platform is dedicated to one organisation.
○ They can also run in Public Azure if you have Software Assurance
- using Azure Hybrid Use Benefits (AHUB)
○ They cannot run in a multi-tenanted environment, and they have no license mobility
○ If running in a Service Provider, you must submit a License Verification Form to MS
• SPLA licenses must be run in a service provider premises, not on your own premises
○ SPLA licenses are trued up or down each month by the Service Provider
• CSP licenses can run anywhere, including Azure by default
○ CSP licenses are only available for Standard, not for Datacenter
○ CSP licenses are only available on 1 or 3 year terms
You CANNOT mix and match between PAYG and BYOL in Azure Stack. You must choose one licensing method, and then stick with it.
If you will be taking advantage of scale up/down/in/out features of Azure Stack, and turning VMs off when not in use, PAYG will probably work out the most cost effective.
If you're running a multi-tenanted Azure Stack, just go with PAYG, it'll be simpler in the long run.
If you will be running predominantly Linux workloads and a small number of Windows servers in Azure Stack, which will run 24/7/365, it may be most cost-effective to procure 1 or 3 year CSP licenses per VM and run Windows Standard. You will not be able to run (e.g.) nested S2D clusters in Azure Stack in this case, which may be problematic for App Service deployment.
If you'll be running a large number of consistently running Windows workloads, it may be most cost effective to license each host up front for Windows Server datacenter licensing, as this confers unlimited virtualization rights to the host. This is done per core, so the more physical cores per host, the higher the license cost. In SPLA this is paid per month, on-premises it'll be part of a license agreement that likely lasts 1-3 years.
There are other nuanced ways to license Windows Server in Azure Stack, but this should give a reasonable overview. I will edit this post as I get feedback on where I'm missing things, or am just plain wrong :)