iknowjason / PurpleCloud

A little tool to play with Azure Identity - Azure Active Directory lab creation tool
https://www.purplecloud.network
MIT License
498 stars 86 forks source link

ad.py typo on "static" generating errors during IP configuration #9

Closed Johndpete316 closed 2 years ago

Johndpete316 commented 2 years ago

Issue

When running the ad.py script I am running into IP configuration errors.

Error Message

╷ │ Error: expected ip_configuration.0.private_ip_address_allocation to be one of [Dynamic Static], got static │ │ with azurerm_network_interface.dc1-nic-int, │ on dc.tf line 32, in resource "azurerm_network_interface" "dc1-nic-int": │ 32: private_ip_address_allocation = "static" │ ╵

expected_static

Steps to reproduce

$ python3 ad.py --domain_controller --ad_domain MrRobot.local --admin *** --password ** --ad_users 50 --endpoints 3 --location eastus --domain_join --helk

$ terraform init

$ terraform plan -out out1.plan

$ terraaform apply out1.plan

I also modified the ad.py script to be compatible with sizing options available in eastus

In eastus the default sizes are not available

size_win10 = "Standard_A1"
size_dc    = "Standard_A1"
size_helk  = "Standard_DS3_v2"

Instead, I have to switch the sizes to

size_win10 = "Standard_D2as_v4"
size_dc    = "Standard_D2as_v4"
size_helk  = "Standard_D2s_v3"

Solution that worked for me.

I changed the lowercase static on lines 714, 1450, and 1586 to uppercase as the error suggests. With this change the terraform apply completes successfully and the range is built.

From

private_ip_address_allocation = "static"

To

private_ip_address_allocation = "Static"
iknowjason commented 2 years ago

@Johndpete316

Thanks for opening this issue and sharing your detailed testing results. I have pushed up a change in ad.py, fixing the typo on Static. I thought I had fixed this before, so thank you again.

As for the sizing of the VMs in the region, there is a recent issue that has surfaced and Microsoft has made some recent changes with VM skus availability. Some of the VM skus are not available in specific regions with newer azure subscriptions. Apparently this is the cause and you have to open up a support case to be able to use specific skus. Apparently though you can use the sku you listed in eastus. I'll need to do some more research and testing into this with some of my other newer subscriptions, and I'll test out the hypothesis of those sizes working for all regions, new subscriptions. I'm opening up a new issue on this repo around this issue. Thanks again!

iknowjason commented 2 years ago

@Johndpete316

I finished doing some testing. I believe the vm sizes you recommended will work much better and for new azure accounts and across regions. Nice recommendation.

Johndpete316 commented 2 years ago

@iknowjason

Thanks for the quick update. Happy to help!