Unable to create Azure Windows VM

Hi
I am unable to create Windows Virtual Machine.I gone through many blogs, official docs but nothing helped . Somehow one or the other error is popping up.

Terraform version : v0.12.23
My config for creating vm:

resource "azurerm_windows_virtual_machine" "resource_virtual_machine" {
name = "${var.virtual-machine}"
location = "${azurerm_resource_group.resource_group_name.location}"
resource_group_name = "${azurerm_resource_group.resource_group_name.name}"
size = "Standard_B1ls"
admin_username = "${var.admin}"
admin_password = "${var.password}"
network_interface_ids = ["${azurerm_network_interface.resource_network_interface.id}"]

os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"

}

source_image_reference{
publisher="MicrosoftWindowsDesktop"
offer="Windows-10"
sku="19h1-ent"
version="18362.592.2001092016"
}
}

Error : compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCode=400 – Original Error: Code=“InvalidParameter” Message=“The Admin Username specified is not allowed.” Target="adminUsername"

Note : Storage_image_reference , os_profile_windows_config, os_profile

I have tried using all the above options in the config file but every time i get a new error stating the "
os_profile is not expected here".

Solutions & suggestions appreciated.
Thank you

Hi @NisharunnisaShaik,

Did you ever find the solution to this?

It’s not a very helpful error. I have a feeling it’s a hangup from the old azurerm_virtual_machine resource.

T. I. A.

Although the OP’s issue and my issue are slightly different, people searching for os_profile is not expected here may have hit an issue trying to consume Shared Gallery Images.

I’ve raised a bug for it:

Nope , I havent got the Solution for it Yet