Closed alex-frankel closed 4 years ago
Thanks, Alex, makes sense. I will look into this.
@alex-frankel this has been fixed, version was moved to 1.4.2 and published to the marketplace.
Thanks for submitting the issue.
Re-opening, this may still be an issue.
@alex-frankel I was able to reproduce the issue with the updated code, however, found the issue intermittent and was not able to sniff out root cause.
That said, I have made some updates to the logic, and can no longer reproduce.
I think it's good to go, but if you run into it again, please let me know.
The updated version is 1.5.1.
Able to reproduce using 1.5.1 [Updated]. This only occurs when you try to assign a Blueprint that is stored at the Management Group level. Works fine if you work from a subscription level.
2019-10-16T10:28:29.3658720Z ##[section]Starting: Assign Azure Blueprint 2019-10-16T10:28:29.4049384Z ============================================================================== 2019-10-16T10:28:29.4049589Z Task : Assign Azure Blueprint 2019-10-16T10:28:29.4049657Z Description : Assigns an Azure Blueprint 2019-10-16T10:28:29.4049738Z Version : 1.5.1 2019-10-16T10:28:29.4049793Z Author : Neil Peterson 2019-10-16T10:28:29.4049867Z Help : 2019-10-16T10:28:29.4049932Z ============================================================================== 2019-10-16T10:29:03.2919164Z WARNING: Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the 2019-10-16T10:29:03.2919855Z same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can 2019-10-16T10:29:03.2920319Z use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure 2019-10-16T10:29:03.2920585Z Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found 2019-10-16T10:29:03.2921051Z here: https://aka.ms/azps-migration-guide 2019-10-16T10:29:05.2379403Z 2019-10-16T10:29:10.1426204Z ##[error]An assignment with name 'Astromech_Assignment' in subscription '/subscriptions/abcf8e1a-0d09-42db-8f31-2cb53d8f6f6f' already exists. Please use Set-AzBlueprintAssignment to update an existing assignment. 2019-10-16T10:29:10.1999741Z ##[section]Finishing: Assign Azure Blueprint
@whaakman thanks for this. I am on vacation, returning mid-next week. I will take a look at that time.
In the interim, I will open this issue back up.
@whaakman I am not able to reproduce but have added some crude logging to the assignment that might help us understand what is going on.
The new version is 1.5.3. Can you please re-run and share the logging here?
Thanks
I just tested it again and switched my BPs from subscription scope to a management group scope, I kid you not; it's working now and I did exactly the same as I did last week. Appreciate the extra logging tho. Running a few more tests and building some demo's. If I run into this again (or something else) I will let you know :)
Yep, no worries. This one has been pretty weird, I've seen intermittent issues but have not been able to repro since a non-related refactor.
I'll go ahead and close the issue. We can open back up if it creeps back in.
Task only can create a new assignment, but if that assignment already exists, the Assign Task will fail. Need to check for the existence of the assignment, and if it exists use Set-AzBlueprintAssignment
Current error: An assignment with name 'pla-foundation-with-pci' in subscription '/subscriptions/e93d3ee6-fac1-412f-92d6-bfb379e81af2' already exists. Please use Set-AzBlueprintAssignment to update an existing assignment.