# dedicated-hosts-manager **Repository Path**: mirrors_Azure/dedicated-hosts-manager ## Basic Information - **Project Name**: dedicated-hosts-manager - **Description**: Utilities managing Azure Dedicated Hosts (starting, stopping as needed) and recommending hosts for VM placement. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-19 - **Last Updated**: 2026-04-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Dedicated Hosts Manager Azure Dedicated Host (DH) provides physical servers that host one or more Azure virtual machines; host-level isolation means that capacity is dedicated to your organization and servers are not shared with other customers. To use DH, users currently need to manage DH themselves - e.g. when to spin up or spin down Hosts, determine VM placement on Hosts, bin pack VMs compactly on Hosts to minimize Host usage and optimize for cost, or use another Host selection strategy, manage VM creation traffic burst scenarios, etc. The Dedicated Hosts Manager library abstracts Host Management logic from users, and makes it easy for users to use DH. * **CreateVm**: Users only need to specify the number and SKU of VMs that need to be allocated, and this library takes care of the rest. * **DeleteVM** Users need to specify VM to delete and library will also deallocate any Host that have no allocated VM.s * **PrepareDedicatedHostGroup** This call to the Dedicated Host Manager library will prepare the host group by creating sufficient number of dedicated hosts so that a future call to VM or VMSS creation will be successful. This library is packaged as an Azure Function that can be deployed in your subscription, and is easy to integrate with . The library is extensible and allows for customizing Host selection logic. # Support * Solution supports Azure Function runtime v3 * Developed and tested using VS 2019 # Usage ![Deployment Graph](docs/images/deploymentgraph.PNG) ## Setup DedicatedHostManager 1. Create a Resource Group using the Azure portal/CLI. 2. Deploy an Azure Function to your resource group.
Recommendation is to use App service plan as long running transaction like CreateVM might result in timeout. 3. Create a storage account in your resource group. 4. Create an Azure Redis cache in your resource group. 5. Deploy the Dedicated Hosts Manager function in your resource group, and setup the below config. _Application settings:_ ```json { "name": "APPINSIGHTS_INSTRUMENTATIONKEY", "value": "App Insights Instrumentation Key", }, { "name": "ComputeClientHttpTimeoutMin", "value": "5", }, { "name": "ComputeClientLongRunningOperationRetryTimeoutSeconds", "value": "5", }, { "name": "DedicatedHostCacheTtlMin", "value": "5", }, { "name": "DhgCreateRetryCount", "value": "3", }, { "name": "GetArmMetadataRetryCount", "value": "3", }, { "name": "GetArmMetadataUrl", "value": "https://management.azure.com/metadata/endpoints?api-version=2019-05-01", }, { "name": "HostSelectorVmSize", "value": "Standard_D2s_v3", }, { "name": "IsRunningInFairfax", "value": "false", }, { "name": "LockContainerName", "value": "dhm-sync", }, { "name": "LockIntervalInSeconds", "value": "60", }, { "name": "LockRetryCount", "value": "10", }, { "name": "MaxIntervalToCheckForVmInSeconds", "value": "30", }, { "name": "MinIntervalToCheckForVmInSeconds", "value": "20", }, { "name": "RedisConnectRetryCount", "value": "3", }, { "name": "RedisConnectTimeoutMilliseconds", "value": "5000", }, { "name": "RedisSyncTimeoutMilliseconds", "value": "10000", }, { "name": "RetryCountToCheckVmState", "value": "10", }, { "name": "VmToHostMapping", "value": "{\"Standard_D2s_v3\":\"DSv3-Type1\",\"Standard_D4s_v3\":\"DSv3-Type1\",\"Standard_D8s_v3\":\"DSv3-Type1\",\"Standard_D16s_v3\":\"DSv3-Type1\",\"Standard_D32-8s_v3\":\"DSv3-Type1\",\"Standard_D32-16s_v3\":\"DSv3-Type1\",\"Standard_D32s_v3\":\"DSv3-Type1\",\"Standard_D48s_v3\":\"DSv3-Type1\",\"Standard_D64-16s_v3\":\"DSv3-Type1\",\"Standard_D64-32s_v3\":\"DSv3-Type1\",\"Standard_D64s_v3\":\"DSv3-Type1\",\"Standard_E2s_v3\":\"ESv3-Type1\",\"Standard_E4s_v3\":\"ESv3-Type1\",\"Standard_E8s_v3\":\"ESv3-Type1\",\"Standard_E16s_v3\":\"ESv3-Type1\",\"Standard_E32-8s_v3\":\"ESv3-Type1\",\"Standard_E32-16s_v3\":\"ESv3-Type1\",\"Standard_E32s_v3\":\"ESv3-Type1\",\"Standard_E48s_v3\":\"ESv3-Type1\",\"Standard_E64-16s_v3\":\"ESv3-Type1\",\"Standard_E64-32s_v3\":\"ESv3-Type1\",\"Standard_E64s_v3\":\"ESv3-Type1\",\"Standard_F2s_v3\":\"FSv2-Type2\",\"Standard_F4s_v3\":\"FSv2-Type2\",\"Standard_F8s_v3\":\"FSv2-Type2\",\"Standard_F16s_v3\":\"FSv2-Type2\",\"Standard_F32-8s_v3\":\"FSv2-Type2\",\"Standard_F32-16s_v3\":\"FSv2-Type2\",\"Standard_F32s_v3\":\"FSv2-Type2\",\"Standard_F48s_v3\":\"FSv2-Type2\",\"Standard_F64-16s_v3\":\"FSv2-Type2\",\"Standard_F64-32s_v3\":\"FSv2-Type2\",\"Standard_F64s_v3\":\"FSv2-Type2\"}", } , { "name": "DedicatedHostMapping", "value": "[{\"family\":\"DSv3\",\"hostMapping\":[{\"region\":\"default\",\"host\":{\"type\":\"DSv3-Type1\",\"vmMapping\":[{\"size\":\"Standard_D2s_v3\",\"capacity\":32},{\"size\":\"Standard_D4s_v3\",\"capacity\":16},{\"size\":\"Standard_D8s_v3\",\"capacity\":8},{\"size\":\"Standard_D16s_v3\",\"capacity\":4},{\"size\":\"Standard_D32s_v3\",\"capacity\":2},{\"size\":\"Standard_D48s_v3\",\"capacity\":1},{\"size\":\"Standard_D64s_v3\",\"capacity\":1}]}}]}]", } ``` _Connection strings:_ ```json { "name": "StorageConnectionString", "value": "", }, { "name": "RedisConnectionString", "value": "", } ``` ## Sample Client Apps Integrate the Dedicated Host Manager library/function to proxy create/delete VM calls for your existing code.(\Under DedicatedHostManagerClients) 1. If needed, deploy the Dedicated Host Manager Test client (function) in your resource group or Console App on your local machine 2. Configure application settings on the Client app. _Application settings:_ ```json { "name": "AuthEndpoint", "value": "https://login.microsoftonline.us/", }, { "name": "AzureRmEndpoint", "value": "https://management.usgovcloudapi.net/", }, { "name": "CloudName", "value": "", }, { "name": "ResourceManagerUri", "value": "https://management.azure.com/", }, { "name": "TenantId", "value": "", }, { "name": "SubscriptionId", "value": "", }, { "name": "ClientId", "value": "", }, { "name": "FairfaxClientSecret", "value": "", }, { "name": "Location", "value": "", }, { "name": "DhmCreateVmnUri", "value": "", }, { "name": "DhmDeleteVmnUri", "value": "