# Unable to create Azure Windows VM

**URL:** <https://discuss.hashicorp.com/t/unable-to-create-azure-windows-vm/6672>\
**Category:** Azure\
**Created:** [March 10, 2020, 4:26am UTC](https://discuss.hashicorp.com/t/unable-to-create-azure-windows-vm/6672 "2020-03-10T04:26:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NisharunnisaShaik](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/nisharunnisashaik/32/5227_2.png) [@NisharunnisaShaik](https://discuss.hashicorp.com/u/NisharunnisaShaik)\
**Post date:** [March 10, 2020, 4:26am UTC](https://discuss.hashicorp.com/t/unable-to-create-azure-windows-vm/6672/1 "2020-03-10T04:26:23Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

**Author:** ![arcotek-ltd](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/arcotek-ltd/32/1674_2.png) [@arcotek-ltd](https://discuss.hashicorp.com/u/arcotek-ltd)\
**Post date:** [July 16, 2020, 1:29am UTC](https://discuss.hashicorp.com/t/unable-to-create-azure-windows-vm/6672/2 "2020-07-16T01:29:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![arcotek-ltd](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/arcotek-ltd/32/1674_2.png) [@arcotek-ltd](https://discuss.hashicorp.com/u/arcotek-ltd)\
**Post date:** [July 16, 2020, 2:29am UTC](https://discuss.hashicorp.com/t/unable-to-create-azure-windows-vm/6672/3 "2020-07-16T02:29:45Z")

</div>

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:

> <https://github.com/terraform-providers/terraform-provider-azurerm/issues/7772>
>
> Community Note
> Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers...

---

<div class="post-metadata">

**Author:** ![NisharunnisaShaik](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/nisharunnisashaik/32/5227_2.png) [@NisharunnisaShaik](https://discuss.hashicorp.com/u/NisharunnisaShaik)\
**Post date:** [May 6, 2021, 10:42am UTC](https://discuss.hashicorp.com/t/unable-to-create-azure-windows-vm/6672/4 "2021-05-06T10:42:39Z")

</div>

Nope , I havent got the Solution for it Yet

---

<div class="post-metadata">

**Author:** ![swin](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@swin](https://discuss.hashicorp.com/u/swin)\
**Post date:** [July 8, 2024, 10:34am UTC](https://discuss.hashicorp.com/t/unable-to-create-azure-windows-vm/6672/5 "2024-07-08T10:34:49Z")

</div>

What about now, 3 years later?

---

<div class="post-metadata">

**Author:** ![apparentlymart](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/apparentlymart/32/702_2.png) [@apparentlymart](https://discuss.hashicorp.com/u/apparentlymart)\
**Post date:** [July 15, 2024, 5:55pm UTC](https://discuss.hashicorp.com/t/unable-to-create-azure-windows-vm/6672/8 "2024-07-15T17:55:58Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
