[Feature]: Allow New-AzPolicySetDefinition to read a template from github and deploy it #25508
Labels
customer-reported
feature-request
This issue requires a new behavior in the product in order be resolved.
needs-triage
This is a new issue that needs to be triaged to the appropriate team.
Description of the new feature
Today, the commandlet expects a part of the json of a Policy Set Definition. It should be possible to deploy the full json, as it can be viewed in the Azure Portal or downloaded from github (example: https://github.com/Azure/Enterprise-Scale/blob/main/src/resources/Microsoft.Authorization/policySetDefinitions/Deploy-Private-DNS-Zones.json). The REST api expects a full json as well.
Today (commandlet help):
![image](./?url=aHR0cHM6Ly9wcml2YXRlLXVzZXItaW1hZ2VzLmdpdGh1YnVzZXJjb250ZW50LmNvbS8xNjI1Mzk4NC8zNDc3NzIzNjEtYWFhMWM5MmQtMmM5MC00YTRhLTgzZjItM2NhNjFhZGY4YTUyLnBuZz9qd3Q9ZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SnBjM01pT2lKbmFYUm9kV0l1WTI5dElpd2lZWFZrSWpvaWNtRjNMbWRwZEdoMVluVnpaWEpqYjI1MFpXNTBMbU52YlNJc0ltdGxlU0k2SW10bGVUVWlMQ0psZUhBaU9qRTNNalF3T1RRNU1ERXNJbTVpWmlJNk1UY3lOREE1TkRZd01Td2ljR0YwYUNJNklpOHhOakkxTXprNE5DOHpORGMzTnpJek5qRXRZV0ZoTVdNNU1tUXRNbU01TUMwMFlUUmhMVGd6WmpJdE0yTmhOakZoWkdZNFlUVXlMbkJ1Wno5WUxVRnRlaTFCYkdkdmNtbDBhRzA5UVZkVE5DMUlUVUZETFZOSVFUSTFOaVpZTFVGdGVpMURjbVZrWlc1MGFXRnNQVUZMU1VGV1EwOUVXVXhUUVRVelVGRkxORnBCSlRKR01qQXlOREE0TVRrbE1rWjFjeTFsWVhOMExURWxNa1p6TXlVeVJtRjNjelJmY21WeGRXVnpkQ1pZTFVGdGVpMUVZWFJsUFRJd01qUXdPREU1VkRFNU1UQXdNVm9tV0MxQmJYb3RSWGh3YVhKbGN6MHpNREFtV0MxQmJYb3RVMmxuYm1GMGRYSmxQVEEwTmpGaU1Ea3hOekk0TTJSbE9ERTBORFppTVRSbU1UWm1aalJrTm1VeFpXWmlaak5tWW1ZNVlqUmlNRGMxT1RreFpXTXdaR1l6WldZNU16azVNRFVtV0MxQmJYb3RVMmxuYm1Wa1NHVmhaR1Z5Y3oxb2IzTjBKbUZqZEc5eVgybGtQVEFtYTJWNVgybGtQVEFtY21Wd2IxOXBaRDB3SW4wLktUaEdVNllPWUQwOU51Q2hzbDhKUExaUjVlZzZqVm5fV2hqUDY3ZlQyUG8=&__proxy_form=0)
Suggestion (taken from the REST API https://learn.microsoft.com/en-us/rest/api/policy/policy-set-definitions/create-or-update?view=rest-policy-2023-04-01&tabs=HTTP&tryIt=true&source=docs#code-try-0):
![image](./?url=aHR0cHM6Ly9wcml2YXRlLXVzZXItaW1hZ2VzLmdpdGh1YnVzZXJjb250ZW50LmNvbS8xNjI1Mzk4NC8zNDc3NzI2MzYtYzYwZDM5OTgtY2Q5Mi00NWE5LWJiOTktNzEwYTI2YWI5YzNlLnBuZz9qd3Q9ZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SnBjM01pT2lKbmFYUm9kV0l1WTI5dElpd2lZWFZrSWpvaWNtRjNMbWRwZEdoMVluVnpaWEpqYjI1MFpXNTBMbU52YlNJc0ltdGxlU0k2SW10bGVUVWlMQ0psZUhBaU9qRTNNalF3T1RRNU1ERXNJbTVpWmlJNk1UY3lOREE1TkRZd01Td2ljR0YwYUNJNklpOHhOakkxTXprNE5DOHpORGMzTnpJMk16WXRZell3WkRNNU9UZ3RZMlE1TWkwME5XRTVMV0ppT1RrdE56RXdZVEkyWVdJNVl6TmxMbkJ1Wno5WUxVRnRlaTFCYkdkdmNtbDBhRzA5UVZkVE5DMUlUVUZETFZOSVFUSTFOaVpZTFVGdGVpMURjbVZrWlc1MGFXRnNQVUZMU1VGV1EwOUVXVXhUUVRVelVGRkxORnBCSlRKR01qQXlOREE0TVRrbE1rWjFjeTFsWVhOMExURWxNa1p6TXlVeVJtRjNjelJmY21WeGRXVnpkQ1pZTFVGdGVpMUVZWFJsUFRJd01qUXdPREU1VkRFNU1UQXdNVm9tV0MxQmJYb3RSWGh3YVhKbGN6MHpNREFtV0MxQmJYb3RVMmxuYm1GMGRYSmxQVFU1TWpCbU5ETmtOekZqTUdZelptRXhOVGswTUdRME16SXpNR0UwTkRVNE1UY3dNbU00TWpReE1Ua3lNVGRsTVdaaU5qQXhaRFk1TnpsbE1qZGpOV1VtV0MxQmJYb3RVMmxuYm1Wa1NHVmhaR1Z5Y3oxb2IzTjBKbUZqZEc5eVgybGtQVEFtYTJWNVgybGtQVEFtY21Wd2IxOXBaRDB3SW4wLlY2VDJjcmpxSEdadUdTcThwVGdsZFhkZl95S19zdU91VWR3SzRVXzA0SXc=&__proxy_form=0)
Proposed implementation details (optional)
Add a new parameter to the commandlet like "-RawPolicyDefinition" that allows the full json to be specified, just like you can download it from github or the Azure portal (Initiative Definition -> JSON) and then deploy it through the REST API today.
![image](./?url=aHR0cHM6Ly9wcml2YXRlLXVzZXItaW1hZ2VzLmdpdGh1YnVzZXJjb250ZW50LmNvbS8xNjI1Mzk4NC8zNDc3NzE4NDEtNTkwMDNjZTktMDc1NS00Njc4LWFkNjctZDhlYTc3M2JmOTI3LnBuZz9qd3Q9ZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SnBjM01pT2lKbmFYUm9kV0l1WTI5dElpd2lZWFZrSWpvaWNtRjNMbWRwZEdoMVluVnpaWEpqYjI1MFpXNTBMbU52YlNJc0ltdGxlU0k2SW10bGVUVWlMQ0psZUhBaU9qRTNNalF3T1RRNU1ERXNJbTVpWmlJNk1UY3lOREE1TkRZd01Td2ljR0YwYUNJNklpOHhOakkxTXprNE5DOHpORGMzTnpFNE5ERXROVGt3TUROalpUa3RNRGMxTlMwME5qYzRMV0ZrTmpjdFpEaGx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