Azure / ipam

IP Address Management on Azure
https://azure.github.io/ipam
MIT License
277 stars 89 forks source link

Deploy not working. Looks like Powershell is doing a long-running silent operation. #310

Open MMollyy opened 3 weeks ago

MMollyy commented 3 weeks ago

Describe the bug It seems that while the following section of code is active the script will be started, powershell will be trying to execute something, however will be in 'forever checking something without continuing' mode:

# Set minimum version requirements
#Requires -Version 7.2
#Requires -Modules @{ ModuleName="Az"; ModuleVersion="10.3.0"}
#Requires -Modules @{ ModuleName="Microsoft.Graph"; ModuleVersion="2.0.0"} 

I checked my versions:

Get-InstalledModule Microsoft.Graph

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
2.22.0               Microsoft.Graph                     PSGallery            Microsoft Graph PowerShell module

Get-InstalledModule Az

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
12.2.0               Az                                  PSGallery            Microsoft Azure PowerShell - Cmdlets to …

Those are good. Upon changing that code to a comment:

# Set minimum version requirements
# Requires -Version 7.2
# Requires -Modules @{ ModuleName="Az"; ModuleVersion="10.3.0"}
# Requires -Modules @{ ModuleName="Microsoft.Graph"; ModuleVersion="2.0.0"}

Suddenly the script continues as it is supposed to.

To Reproduce Steps to reproduce the behavior:

  1. Run deploy.ps1 with whichever parameter you like
  2. Nothing will happen

Expected behavior I expect the script to check the requirements, and continue if those are valid.

Screenshots N/A

system info: PSVersion: 7.4.4 PSEdition: Core GitCommitId: 7.4.4 OS: Microsoft Windows 10.0.19045 Platform: Win32NT PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1, 6.0, 7.0 PSRemotingProtocolVersion: 2.3 SerializationVersion: 1.1.0.1 WSManStackVersion: 3.0


Additional context I am not 100%, hence my posting the issue, but I have a feeling this is a local issue on my laptop. Nonetheless, I am reporting it just in case. I don't necessarily need it fixed, just felt it useful for anyone else running into the same issue. Or if someone has an idea what the issue is, I would be welcome to receiving the input.

DCMattyG commented 3 weeks ago

Hi @MMollyy, what's happening is that due to the Require statements at the top of the deployment script which you have pointed out, the script will check the entire Az package, which has tons of modules within it and that causes the script to take quite some time to begin execution. I am working on reducing this to only the necessary modules which will speed up this process.

TL:DR - I'm aware of this delay and working to remediate it. For now, the running the script for the first time in a new PowerShell session will cause it to take a few minutes to load and verify all of the modules in the Az package. Sorry about that!

MMollyy commented 3 weeks ago

Alright! Good that it's known at least. Thanks for the response.

DCMattyG commented 1 week ago

Hey there @MMollyy, as of the latest release (v3.4.0) this behavior should now be resolved.

I've limited the required modules to only those actually used by the script. There may still be a brief pause while the requirements are checked, however it won't be nearly as long as before (which was quite long).

Please feel free to pull down the latest code from the main branch, test it out, and let me know how everything works for you.

Thanks again for reaching out on this issue!