diff --git a/src/Blueprint/Blueprint.Test/Blueprint.Test.csproj b/src/Blueprint/Blueprint.Test/Blueprint.Test.csproj index 652dd0846e21..c485fe559329 100644 --- a/src/Blueprint/Blueprint.Test/Blueprint.Test.csproj +++ b/src/Blueprint/Blueprint.Test/Blueprint.Test.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/Blueprint/Blueprint.Test/ScenarioTests/ManagementGroupAssignmentTests.cs b/src/Blueprint/Blueprint.Test/ScenarioTests/ManagementGroupAssignmentTests.cs new file mode 100644 index 000000000000..df982fa11af1 --- /dev/null +++ b/src/Blueprint/Blueprint.Test/ScenarioTests/ManagementGroupAssignmentTests.cs @@ -0,0 +1,56 @@ +namespace Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests +{ + using Microsoft.Azure.Commands.ScenarioTest; + using Microsoft.Azure.ServiceManagement.Common.Models; + using Microsoft.WindowsAzure.Commands.ScenarioTest; + using Xunit; + using Xunit.Abstractions; + + public class ManagementGroupAssignmentTests + { + private XunitTracingInterceptor logger; + + public ManagementGroupAssignmentTests(ITestOutputHelper output) + { + + this.logger = new XunitTracingInterceptor(output); + XunitTracingInterceptor.AddToContext(this.logger); + TestExecutionHelpers.SetUpSessionAndProfile(); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetAssignmentsInManagementGroup() + { + TestController.NewInstance.RunPowerShellTest(this.logger, "Test-GetAssignmentsInManagementGroup"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestGetSingleAssignmentInManagementGroup() + { + TestController.NewInstance.RunPowerShellTest(this.logger, "Test-GetSingleAssignmentInManagementGroup"); + } + + [Fact(Skip = "Investigate auto-registration for RP")] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestCreateAssignmentInManagementGroup() + { + TestController.NewInstance.RunPowerShellTest(this.logger, "Test-CreateAssignmentInManagementGroup"); + } + + [Fact(Skip = "Investigate auto-registration for RP")] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestUpdateAssignmentInManagementGroup() + { + TestController.NewInstance.RunPowerShellTest(this.logger, "Test-UpdateAssignmentInManagementGroup"); + } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestRemoveAssignmentInManagementGroup() + { + TestController.NewInstance.RunPowerShellTest(this.logger, "Test-RemoveAssignmentInManagementGroup"); + } + } +} diff --git a/src/Blueprint/Blueprint.Test/ScenarioTests/ManagementGroupAssignmentTests.ps1 b/src/Blueprint/Blueprint.Test/ScenarioTests/ManagementGroupAssignmentTests.ps1 new file mode 100644 index 000000000000..d70cdfa15d19 --- /dev/null +++ b/src/Blueprint/Blueprint.Test/ScenarioTests/ManagementGroupAssignmentTests.ps1 @@ -0,0 +1,110 @@ +$managementGroupId = "AzBlueprintAssignTest" +$subscriptionId = "a1bfa635-f2bf-42f1-86b5-848c674fc321" +$location = "West US" +$blueprintName = "shenglol-ps-test-bp" +$permanentAssignmentName = "shenglol-ps-test-permanent-assignment" +$transientAssignmentName = "shenglol-ps-test-transient-assignment" + +<# +.SYNOPSIS +Test getting Blueprint assignments in a management group. +#> +function Test-GetAssignmentsInManagementGroup +{ + $assignments = Get-AzBlueprintAssignment -ManagementGroupId $managementGroupId + Assert-True { $assignments.Count -ge 1 } + + $assignment = $assignments | where { $_.Name -eq $permanentAssignmentName } + Assert-NotNull $assignment +} + +<# +.SYNOPSIS +Test getting single Blueprint assignment in a management group. +#> +function Test-GetSingleAssignmentInManagementGroup +{ + $assignment = Get-AzBlueprintAssignment -Name $permanentAssignmentName -ManagementGroupId $managementGroupId + Assert-NotNull $assignment + Assert-AreEqual $permanentAssignmentName $assignment.Name +} + +<# +.SYNOPSIS +Test creating a Blueprint assignment in a management group. +#> +function Test-CreateAssignmentInManagementGroup +{ + $blueprint = $blueprint = Get-AzBlueprint -Name $blueprintName -ManagementGroupId $managementGroupId + $rgParameters = @{ProdRG=@{name='shenglol-ps-test-02';location='westus'}} + + $assignment = New-AzBlueprintAssignment ` + -Name $transientAssignmentName ` + -Location $location ` + -Blueprint $blueprint ` + -ResourceGroupParameter $rgParameters ` + -ManagementGroupId $managementGroupId ` + -SubscriptionId $subscriptionId + + Assert-NotNull $assignment + Assert-AreEqual "Creating" $assignment.ProvisioningState + + $timeout = New-TimeSpan -Minutes 4 + $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() + + while ($assignment.ProvisioningState -ne "Succeeded" -and $assignment.ProvisioningState -ne "Failed" -and $stopwatch.elapsed -lt $timeout) + { + Wait-Seconds 10 + $assignment = Get-AzBlueprintAssignment -Name $transientAssignmentName -ManagementGroupId $managementGroupId + } + + Assert-AreEqual "Succeeded" $assignment.ProvisioningState +} + +<# +.SYNOPSIS +Test updating a Blueprint assignment in a management group. +#> +function Test-updateAssignmentInManagementGroup +{ + $blueprint = $blueprint = Get-AzBlueprint -Name $blueprintName -ManagementGroupId $managementGroupId + # Update resource group name. + $rgParameters = @{ProdRG=@{name='shenglol-ps-test-03';location='westus'}} + + $assignment = Set-AzBlueprintAssignment ` + -Name $transientAssignmentName ` + -Location $location ` + -Blueprint $blueprint ` + -ResourceGroupParameter $rgParameters ` + -ManagementGroupId $managementGroupId ` + -SubscriptionId $subscriptionId + + Assert-NotNull $assignment + Assert-AreEqual "Creating" $assignment.ProvisioningState + + $timeout = New-TimeSpan -Minutes 4 + $stopwatch = [System.Diagnostics.Stopwatch]::StartNew() + + while ($assignment.ProvisioningState -ne "Succeeded" -and $assignment.ProvisioningState -ne "Failed" -and $stopwatch.elapsed -lt $timeout) + { + Wait-Seconds 10 + $assignment = Get-AzBlueprintAssignment -Name $transientAssignmentName -ManagementGroupId $managementGroupId + } + + Assert-AreEqual "Succeeded" $assignment.ProvisioningState +} + +<# +.SYNOPSIS +Test removing a Blueprint assignment in a management group. +#> +function Test-RemoveAssignmentInManagementGroup +{ + $assignment = Remove-AzBlueprintAssignment ` + -Name $transientAssignmentName ` + -ManagementGroupId $managementGroupId ` + -PassThru + + Assert-NotNull $assignment + Assert-AreEqual "Deleting" $assignment.ProvisioningState +} diff --git a/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestCreateAssignmentInManagementGroup.json b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestCreateAssignmentInManagementGroup.json new file mode 100644 index 000000000000..23a07beae071 --- /dev/null +++ b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestCreateAssignmentInManagementGroup.json @@ -0,0 +1,524 @@ +{ + "Entries": [ + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50cy9zaGVuZ2xvbC1wcy10ZXN0LWJwP2FwaS12ZXJzaW9uPTIwMTgtMTEtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "400a568b-74c8-4089-be94-b792ac17082d" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "bd5b5c97-8bb3-4653-adfd-aaf241f16ba3" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "53a7d83b-716e-4082-9d29-22ed8d5e9b3e" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T230819Z:53a7d83b-716e-4082-9d29-22ed8d5e9b3e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:08:18 GMT" + ], + "Content-Length": [ + "658" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"metadata\": {\r\n \"displayName\": \"Production resource group\"\r\n },\r\n \"dependsOn\": []\r\n }\r\n },\r\n \"targetScope\": \"subscription\",\r\n \"status\": {\r\n \"timeCreated\": \"2020-04-14T13:59:48-07:00\",\r\n \"lastModified\": \"2020-04-14T14:00:46.9452902-07:00\"\r\n },\r\n \"displayName\": \"Common Policies\"\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp\",\r\n \"type\": \"Microsoft.Blueprint/blueprints\",\r\n \"name\": \"shenglol-ps-test-bp\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "647bb9f3-77b6-45ba-b2ef-d4d17f656543" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "83c9e04b-bcf3-4ce9-8873-f8c89b6afc8a" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11998" + ], + "x-ms-correlation-request-id": [ + "0980379c-20ce-4581-b80c-7395db45937d" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T230819Z:0980379c-20ce-4581-b80c-7395db45937d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:08:18 GMT" + ], + "Content-Length": [ + "191" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"AssignmentNotFound\",\r\n \"message\": \"Assignment 'shenglol-ps-test-transient-assignment' could not be found in management group 'AzBlueprintAssignTest'.\"\r\n }\r\n}", + "StatusCode": 404 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ae542c06-a386-4d6d-b031-d1bd52ec7e8a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "a1fb187a-a6be-4560-8d3a-0e3a7d984ac5" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11997" + ], + "x-ms-correlation-request-id": [ + "9dba2c22-e8c6-4c34-824e-8b50da64f56d" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T230834Z:9dba2c22-e8c6-4c34-824e-8b50da64f56d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:08:34 GMT" + ], + "Content-Length": [ + "1113" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"497b7101-b38c-4da9-8faa-9d89d75e7a09\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"West US\",\r\n \"properties\": {\r\n \"provisioningState\": \"deploying\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-02\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"timeCreated\": \"2020-04-14T16:08:24-07:00\",\r\n \"lastModified\": \"2020-04-14T16:08:23.9533462-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-transient-assignment\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "8b01f305-2b5d-4968-8f5f-e4f22c2934fe" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "e4664c89-9fb6-43ad-a22d-b936e6ea1a33" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11996" + ], + "x-ms-correlation-request-id": [ + "15653741-a2b1-400b-90f3-62c54d61a493" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T230844Z:15653741-a2b1-400b-90f3-62c54d61a493" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:08:44 GMT" + ], + "Content-Length": [ + "1144" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"497b7101-b38c-4da9-8faa-9d89d75e7a09\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"West US\",\r\n \"properties\": {\r\n \"provisioningState\": \"succeeded\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-02\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"managedResources\": [],\r\n \"timeCreated\": \"2020-04-14T16:08:24-07:00\",\r\n \"lastModified\": \"2020-04-14T16:08:23.9533462-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-transient-assignment\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment/WhoIsBlueprint?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudC9XaG9Jc0JsdWVwcmludD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f1c8d67c-7ceb-40d2-8951-8392d4665682" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "a3871ddd-5668-4ca8-9168-559867155466" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "5633015b-c13b-4a11-ae07-7a1918d23c2a" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T230819Z:5633015b-c13b-4a11-ae07-7a1918d23c2a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:08:18 GMT" + ], + "Content-Length": [ + "58" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"objectId\": \"ffeb3a44-712a-4d2e-9b97-b1e032a40b29\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Authorization/roleAssignments?$filter=assignedTo('ffeb3a44-712a-4d2e-9b97-b1e032a40b29')&api-version=2015-07-01", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3JvbGVBc3NpZ25tZW50cz8kZmlsdGVyPWFzc2lnbmVkVG8oJ2ZmZWIzYTQ0LTcxMmEtNGQyZS05Yjk3LWIxZTAzMmE0MGIyOScpJmFwaS12ZXJzaW9uPTIwMTUtMDctMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "c069e402-fee6-4f96-82d5-817aa0110d9f" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Authorization.Version2015.07.01.AuthorizationManagementClient/1.3.11" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "fa68da56-fe6e-49e5-85e0-9d37c8da0366" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Set-Cookie": [ + "x-ms-gateway-slice=Production; path=/; SameSite=None; secure; HttpOnly" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "ed3798e9-8d1f-4abc-9425-55cc0659fbc3" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T230820Z:ed3798e9-8d1f-4abc-9425-55cc0659fbc3" + ], + "Date": [ + "Tue, 14 Apr 2020 23:08:19 GMT" + ], + "Content-Length": [ + "719" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"roleDefinitionId\": \"/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635\",\r\n \"principalId\": \"ffeb3a44-712a-4d2e-9b97-b1e032a40b29\",\r\n \"scope\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest\",\r\n \"createdOn\": \"2020-04-14T21:02:17.755131Z\",\r\n \"updatedOn\": \"2020-04-14T21:02:17.755131Z\",\r\n \"createdBy\": \"b0b8600b-83ec-4fed-8430-bec5b21d2c8a\",\r\n \"updatedBy\": \"b0b8600b-83ec-4fed-8430-bec5b21d2c8a\"\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Authorization/roleAssignments/a2090015-c331-4e2f-ad0f-6d9f8508def8\",\r\n \"type\": \"Microsoft.Authorization/roleAssignments\",\r\n \"name\": \"a2090015-c331-4e2f-ad0f-6d9f8508def8\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Authorization/roleAssignments/1aea2945-fdda-4516-b476-e5550d6c75ab?api-version=2015-07-01", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3JvbGVBc3NpZ25tZW50cy8xYWVhMjk0NS1mZGRhLTQ1MTYtYjQ3Ni1lNTU1MGQ2Yzc1YWI/YXBpLXZlcnNpb249MjAxNS0wNy0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"roleDefinitionId\": \"/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635\",\r\n \"principalId\": \"ffeb3a44-712a-4d2e-9b97-b1e032a40b29\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "0454d4db-fb13-4e23-bb00-42c1fa2c1167" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Authorization.Version2015.07.01.AuthorizationManagementClient/1.3.11" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "203" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "edf34d12-0f75-43ec-8712-309e04878de5" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Set-Cookie": [ + "x-ms-gateway-slice=Production; path=/; secure; HttpOnly; SameSite=None" + ], + "x-ms-ratelimit-remaining-tenant-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "47a5e237-2d09-4e88-8644-fb0d4776b603" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T230820Z:47a5e237-2d09-4e88-8644-fb0d4776b603" + ], + "Date": [ + "Tue, 14 Apr 2020 23:08:20 GMT" + ], + "Content-Length": [ + "89" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"RoleAssignmentExists\",\r\n \"message\": \"The role assignment already exists.\"\r\n }\r\n}", + "StatusCode": 409 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"identity\": {\r\n \"type\": \"SystemAssigned\"\r\n },\r\n \"properties\": {\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp\",\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-02\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"locks\": {\r\n \"mode\": \"None\"\r\n }\r\n },\r\n \"location\": \"West US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "55325a7c-4fae-49a0-a28b-ed604c34fdf4" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "530" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "f8461b1f-83df-4d65-8a36-4be4da9c01e5" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "428bdbb4-b802-42e1-8ac1-04e4f8cb7d47" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T230824Z:428bdbb4-b802-42e1-8ac1-04e4f8cb7d47" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:08:24 GMT" + ], + "Content-Length": [ + "1112" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"497b7101-b38c-4da9-8faa-9d89d75e7a09\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"West US\",\r\n \"properties\": {\r\n \"provisioningState\": \"creating\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-02\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"timeCreated\": \"2020-04-14T16:08:24-07:00\",\r\n \"lastModified\": \"2020-04-14T16:08:23.9533462-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-transient-assignment\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a1bfa635-f2bf-42f1-86b5-848c674fc321" + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestGetAssignmentsInManagementGroup.json b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestGetAssignmentsInManagementGroup.json new file mode 100644 index 000000000000..e96caf6f1504 --- /dev/null +++ b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestGetAssignmentsInManagementGroup.json @@ -0,0 +1,71 @@ +{ + "Entries": [ + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHM/YXBpLXZlcnNpb249MjAxOC0xMS0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "db975379-8708-4df5-a61d-2250343f79fd" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "78327a70-8abf-4e1d-99c1-2204798dccd5" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "f388b155-7363-4e6e-bc61-576323cf58bb" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T225318Z:f388b155-7363-4e6e-bc61-576323cf58bb" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 22:53:17 GMT" + ], + "Content-Length": [ + "1292" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"468ec5fd-0114-479b-a1cb-d0fe35126ed2\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"succeeded\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-01\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"managedResources\": [],\r\n \"timeCreated\": \"2020-04-14T14:03:45-07:00\",\r\n \"lastModified\": \"2020-04-14T14:03:45.2845977-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-permanent-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-permanent-assignment\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a1bfa635-f2bf-42f1-86b5-848c674fc321" + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestGetSingleAssignmentInManagementGroup.json b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestGetSingleAssignmentInManagementGroup.json new file mode 100644 index 000000000000..02fd56d0a111 --- /dev/null +++ b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestGetSingleAssignmentInManagementGroup.json @@ -0,0 +1,71 @@ +{ + "Entries": [ + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-permanent-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC1wZXJtYW5lbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "d262206c-85a4-4a76-a25a-6031c0a9dc9b" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "4244dee9-8a18-4e95-bdcc-aa92e1165a8a" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "bc81f55b-6c4d-4434-bc93-a9a851b3b741" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T225320Z:bc81f55b-6c4d-4434-bc93-a9a851b3b741" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 22:53:20 GMT" + ], + "Content-Length": [ + "1143" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"468ec5fd-0114-479b-a1cb-d0fe35126ed2\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"succeeded\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-01\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"managedResources\": [],\r\n \"timeCreated\": \"2020-04-14T14:03:45-07:00\",\r\n \"lastModified\": \"2020-04-14T14:03:45.2845977-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-permanent-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-permanent-assignment\"\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a1bfa635-f2bf-42f1-86b5-848c674fc321" + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestRemoveAssignmentInManagementGroup.json b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestRemoveAssignmentInManagementGroup.json new file mode 100644 index 000000000000..db55aecd06cd --- /dev/null +++ b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestRemoveAssignmentInManagementGroup.json @@ -0,0 +1,71 @@ +{ + "Entries": [ + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "fd8460bc-70c3-447a-83fe-9bfa6aee7e24" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "fc74e824-7391-40c4-aebe-829f63cadd83" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-deletes": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "047cd3f4-a182-49c8-a494-f58c6cb86e45" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T231818Z:047cd3f4-a182-49c8-a494-f58c6cb86e45" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:18:17 GMT" + ], + "Content-Length": [ + "1143" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"497b7101-b38c-4da9-8faa-9d89d75e7a09\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"West US\",\r\n \"properties\": {\r\n \"provisioningState\": \"deleting\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-03\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"managedResources\": [],\r\n \"timeCreated\": \"2020-04-14T16:08:24-07:00\",\r\n \"lastModified\": \"2020-04-14T16:14:22.2699587-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-transient-assignment\"\r\n}", + "StatusCode": 202 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a1bfa635-f2bf-42f1-86b5-848c674fc321" + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestUpdateAssignmentInManagementGroup.json b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestUpdateAssignmentInManagementGroup.json new file mode 100644 index 000000000000..a3191d8d7daa --- /dev/null +++ b/src/Blueprint/Blueprint.Test/SessionRecords/Microsoft.Azure.Commands.Blueprint.Test.ScenarioTests.ManagementGroupAssignmentTests/TestUpdateAssignmentInManagementGroup.json @@ -0,0 +1,524 @@ +{ + "Entries": [ + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50cy9zaGVuZ2xvbC1wcy10ZXN0LWJwP2FwaS12ZXJzaW9uPTIwMTgtMTEtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "59b21127-e83f-4e22-b4d7-fe10ec91b081" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "a59d7928-e688-4316-9754-c3de10f49db6" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "44ca3188-b574-4872-a472-a58c88c830bf" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T231419Z:44ca3188-b574-4872-a472-a58c88c830bf" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:14:18 GMT" + ], + "Content-Length": [ + "658" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"metadata\": {\r\n \"displayName\": \"Production resource group\"\r\n },\r\n \"dependsOn\": []\r\n }\r\n },\r\n \"targetScope\": \"subscription\",\r\n \"status\": {\r\n \"timeCreated\": \"2020-04-14T13:59:48-07:00\",\r\n \"lastModified\": \"2020-04-14T14:00:46.9452902-07:00\"\r\n },\r\n \"displayName\": \"Common Policies\"\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp\",\r\n \"type\": \"Microsoft.Blueprint/blueprints\",\r\n \"name\": \"shenglol-ps-test-bp\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "8d8f3571-089f-4b2f-ad68-edb0af44647b" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "245fdba9-2e95-4477-9720-9aa0b4866702" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11998" + ], + "x-ms-correlation-request-id": [ + "fe454d38-52cc-4386-b8fc-952a8040999c" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T231419Z:fe454d38-52cc-4386-b8fc-952a8040999c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:14:18 GMT" + ], + "Content-Length": [ + "1144" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"497b7101-b38c-4da9-8faa-9d89d75e7a09\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"West US\",\r\n \"properties\": {\r\n \"provisioningState\": \"succeeded\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-02\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"managedResources\": [],\r\n \"timeCreated\": \"2020-04-14T16:08:24-07:00\",\r\n \"lastModified\": \"2020-04-14T16:08:23.9533462-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-transient-assignment\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1fe33023-2275-4b88-84c5-850446f7638a" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "d1ad12bb-46da-458e-8778-e652b9caaec8" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11997" + ], + "x-ms-correlation-request-id": [ + "bf97b27c-20cb-44ab-940f-aba71d528634" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T231432Z:bf97b27c-20cb-44ab-940f-aba71d528634" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:14:32 GMT" + ], + "Content-Length": [ + "1142" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"497b7101-b38c-4da9-8faa-9d89d75e7a09\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"West US\",\r\n \"properties\": {\r\n \"provisioningState\": \"locking\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-03\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"managedResources\": [],\r\n \"timeCreated\": \"2020-04-14T16:08:24-07:00\",\r\n \"lastModified\": \"2020-04-14T16:14:22.2699587-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-transient-assignment\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ac1588c7-4476-4c40-8d55-a160e723ffdc" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "367218a4-765e-425b-a37e-34ce042f800f" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11996" + ], + "x-ms-correlation-request-id": [ + "f839cc9a-4faf-4152-af6f-38e230b0fb2a" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T231442Z:f839cc9a-4faf-4152-af6f-38e230b0fb2a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:14:42 GMT" + ], + "Content-Length": [ + "1144" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"497b7101-b38c-4da9-8faa-9d89d75e7a09\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"West US\",\r\n \"properties\": {\r\n \"provisioningState\": \"succeeded\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-03\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"managedResources\": [],\r\n \"timeCreated\": \"2020-04-14T16:08:24-07:00\",\r\n \"lastModified\": \"2020-04-14T16:14:22.2699587-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-transient-assignment\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment/WhoIsBlueprint?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudC9XaG9Jc0JsdWVwcmludD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "POST", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "33858909-2cbc-4838-9e3d-483e7f178e67" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "0017e2b6-3adf-476c-a237-4fa24f2a4ff0" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "fb3e6223-9f9e-4b3f-b06a-6d4e625e49c8" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T231420Z:fb3e6223-9f9e-4b3f-b06a-6d4e625e49c8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:14:19 GMT" + ], + "Content-Length": [ + "58" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"objectId\": \"ffeb3a44-712a-4d2e-9b97-b1e032a40b29\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Authorization/roleAssignments?$filter=assignedTo('ffeb3a44-712a-4d2e-9b97-b1e032a40b29')&api-version=2015-07-01", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3JvbGVBc3NpZ25tZW50cz8kZmlsdGVyPWFzc2lnbmVkVG8oJ2ZmZWIzYTQ0LTcxMmEtNGQyZS05Yjk3LWIxZTAzMmE0MGIyOScpJmFwaS12ZXJzaW9uPTIwMTUtMDctMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ddb81c5e-1047-409c-b0f2-2ec8aad75d4e" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Authorization.Version2015.07.01.AuthorizationManagementClient/1.3.11" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "afef64f7-14fb-43f7-a578-56f6c03c0561" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Set-Cookie": [ + "x-ms-gateway-slice=Production; path=/; SameSite=None; secure; HttpOnly" + ], + "x-ms-ratelimit-remaining-tenant-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "dd4523f6-5474-485c-a761-ed8049cd14d2" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T231420Z:dd4523f6-5474-485c-a761-ed8049cd14d2" + ], + "Date": [ + "Tue, 14 Apr 2020 23:14:20 GMT" + ], + "Content-Length": [ + "719" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"roleDefinitionId\": \"/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635\",\r\n \"principalId\": \"ffeb3a44-712a-4d2e-9b97-b1e032a40b29\",\r\n \"scope\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest\",\r\n \"createdOn\": \"2020-04-14T21:02:17.755131Z\",\r\n \"updatedOn\": \"2020-04-14T21:02:17.755131Z\",\r\n \"createdBy\": \"b0b8600b-83ec-4fed-8430-bec5b21d2c8a\",\r\n \"updatedBy\": \"b0b8600b-83ec-4fed-8430-bec5b21d2c8a\"\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Authorization/roleAssignments/a2090015-c331-4e2f-ad0f-6d9f8508def8\",\r\n \"type\": \"Microsoft.Authorization/roleAssignments\",\r\n \"name\": \"a2090015-c331-4e2f-ad0f-6d9f8508def8\"\r\n }\r\n ]\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Authorization/roleAssignments/5efb6ca5-177f-446e-8487-2d081b902324?api-version=2015-07-01", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3JvbGVBc3NpZ25tZW50cy81ZWZiNmNhNS0xNzdmLTQ0NmUtODQ4Ny0yZDA4MWI5MDIzMjQ/YXBpLXZlcnNpb249MjAxNS0wNy0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"roleDefinitionId\": \"/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635\",\r\n \"principalId\": \"ffeb3a44-712a-4d2e-9b97-b1e032a40b29\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1adf6ad9-b5a2-45da-a476-710b212c5a1c" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Authorization.Version2015.07.01.AuthorizationManagementClient/1.3.11" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "203" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "c24a2a7e-b469-44e6-b7ab-1df672a6d047" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Set-Cookie": [ + "x-ms-gateway-slice=Production; path=/; secure; HttpOnly; SameSite=None" + ], + "x-ms-ratelimit-remaining-tenant-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "e77285d9-f17d-48a1-826d-e49c966a039d" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T231421Z:e77285d9-f17d-48a1-826d-e49c966a039d" + ], + "Date": [ + "Tue, 14 Apr 2020 23:14:21 GMT" + ], + "Content-Length": [ + "89" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"RoleAssignmentExists\",\r\n \"message\": \"The role assignment already exists.\"\r\n }\r\n}", + "StatusCode": 409 + }, + { + "RequestUri": "//providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment?api-version=2018-11-01-preview", + "EncodedRequestUri": "Ly9wcm92aWRlcnMvTWljcm9zb2Z0Lk1hbmFnZW1lbnQvbWFuYWdlbWVudEdyb3Vwcy9BekJsdWVwcmludEFzc2lnblRlc3QvcHJvdmlkZXJzL01pY3Jvc29mdC5CbHVlcHJpbnQvYmx1ZXByaW50QXNzaWdubWVudHMvc2hlbmdsb2wtcHMtdGVzdC10cmFuc2llbnQtYXNzaWdubWVudD9hcGktdmVyc2lvbj0yMDE4LTExLTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"identity\": {\r\n \"type\": \"SystemAssigned\"\r\n },\r\n \"properties\": {\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp\",\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-03\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"locks\": {\r\n \"mode\": \"None\"\r\n }\r\n },\r\n \"location\": \"West US\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b1cadb73-0e55-4ea4-b79e-1ae24117ddaf" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.28619.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.Blueprint.BlueprintManagementClient/0.20.6.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "530" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "7eacf79b-a735-42d7-a604-11e1e27abf66" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-tenant-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "9fe1a4e9-d2b8-4efa-beba-981fcea61f1c" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20200414T231422Z:9fe1a4e9-d2b8-4efa-beba-981fcea61f1c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Tue, 14 Apr 2020 23:14:21 GMT" + ], + "Content-Length": [ + "1143" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"identity\": {\r\n \"type\": \"systemAssigned\",\r\n \"principalId\": \"497b7101-b38c-4da9-8faa-9d89d75e7a09\",\r\n \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\r\n },\r\n \"location\": \"West US\",\r\n \"properties\": {\r\n \"provisioningState\": \"creating\",\r\n \"blueprintId\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprints/shenglol-ps-test-bp/versions/1.0\",\r\n \"parameters\": {},\r\n \"resourceGroups\": {\r\n \"ProdRG\": {\r\n \"name\": \"shenglol-ps-test-03\",\r\n \"location\": \"westus\"\r\n }\r\n },\r\n \"status\": {\r\n \"managedResources\": [],\r\n \"timeCreated\": \"2020-04-14T16:08:24-07:00\",\r\n \"lastModified\": \"2020-04-14T16:14:22.2699587-07:00\"\r\n },\r\n \"scope\": \"/subscriptions/a1bfa635-f2bf-42f1-86b5-848c674fc321\",\r\n \"locks\": {\r\n \"mode\": \"none\"\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Management/managementGroups/AzBlueprintAssignTest/providers/Microsoft.Blueprint/blueprintAssignments/shenglol-ps-test-transient-assignment\",\r\n \"type\": \"Microsoft.Blueprint/blueprintAssignments\",\r\n \"name\": \"shenglol-ps-test-transient-assignment\"\r\n}", + "StatusCode": 201 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "a1bfa635-f2bf-42f1-86b5-848c674fc321" + } +} \ No newline at end of file diff --git a/src/Blueprint/Blueprint/Blueprint.csproj b/src/Blueprint/Blueprint/Blueprint.csproj index 855fdb472ec7..a539b415b0d9 100644 --- a/src/Blueprint/Blueprint/Blueprint.csproj +++ b/src/Blueprint/Blueprint/Blueprint.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Blueprint/Blueprint/Cmdlets/BlueprintArtifacts/BlueprintArtifactsCmdletBase.cs b/src/Blueprint/Blueprint/Cmdlets/BlueprintArtifacts/BlueprintArtifactsCmdletBase.cs index a594dad1ce20..eec17979c839 100644 --- a/src/Blueprint/Blueprint/Cmdlets/BlueprintArtifacts/BlueprintArtifactsCmdletBase.cs +++ b/src/Blueprint/Blueprint/Cmdlets/BlueprintArtifacts/BlueprintArtifactsCmdletBase.cs @@ -27,9 +27,9 @@ namespace Microsoft.Azure.Commands.Blueprint.Cmdlets { public class BlueprintArtifactsCmdletBase : BlueprintCmdletBase { - protected Dictionary GetPolicyAssignmentParameters(Hashtable policyParameter) + protected Dictionary GetPolicyAssignmentParameters(Hashtable policyParameter) { - var policyAssignmentParameters = new Dictionary(); + var policyAssignmentParameters = new Dictionary(); foreach (var key in policyParameter.Keys) { @@ -52,9 +52,9 @@ protected string ValidateAndReturnFilePath(string filePath) return templatePath; } - protected Dictionary GetTemplateParametersFromFile(string validatedFilePath) + protected Dictionary GetTemplateParametersFromFile(string validatedFilePath) { - Dictionary parameters = new Dictionary(); + Dictionary parameters = new Dictionary(); JObject parsedJson = JObject.Parse(AzureSession.Instance.DataStore.ReadFileAsText(validatedFilePath)); diff --git a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/BlueprintAssignmentCmdletBase.cs b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/BlueprintAssignmentCmdletBase.cs index fb05a4168589..7580ff4271c0 100644 --- a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/BlueprintAssignmentCmdletBase.cs +++ b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/BlueprintAssignmentCmdletBase.cs @@ -62,7 +62,7 @@ protected Assignment CreateAssignmentObject(string identityType, string userAssi Location = bpLocation, BlueprintId = blueprintId, Locks = new AssignmentLockSettings { Mode = lockMode == null ? PSLockMode.None.ToString() : lockMode.ToString() }, - Parameters = new Dictionary(), + Parameters = new Dictionary(), ResourceGroups = new Dictionary() }; @@ -102,7 +102,7 @@ protected Assignment CreateAssignmentObject(string identityType, string userAssi } } - var secretValue = new SecretReferenceParameterValue(new SecretValueReference(new KeyVaultReference(keyVaultId), secretName, secretVersion)); + var secretValue = new ParameterValue(reference: new SecretValueReference(new KeyVaultReference(keyVaultId), secretName, secretVersion)); localAssignment.Parameters.Add(key.ToString(), secretValue); } } @@ -161,10 +161,8 @@ protected string GetBlueprintSpn(string scope, string assignmentName) /// /// /// - protected void AssignOwnerPermission(string subscriptionId, string spnObjectId) + protected void AssignOwnerPermission(string scope, string spnObjectId) { - string scope = string.Format(BlueprintConstants.SubscriptionScope, subscriptionId); - var filter = new Rest.Azure.OData.ODataQuery(); filter.SetFilter(a => a.AssignedTo(spnObjectId)); diff --git a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/GetAzureRMBlueprintAssignment.cs b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/GetAzureRMBlueprintAssignment.cs index 57d87e39ad95..d8c864bd2a48 100644 --- a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/GetAzureRMBlueprintAssignment.cs +++ b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/GetAzureRMBlueprintAssignment.cs @@ -20,18 +20,24 @@ namespace Microsoft.Azure.Commands.Blueprint.Cmdlets { - [Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "BlueprintAssignment", DefaultParameterSetName = ParameterSetNames.BlueprintAssignmentsBySubscription), OutputType(typeof(PSBlueprintAssignment))] + [Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "BlueprintAssignment", DefaultParameterSetName = ParameterSetNames.SubscriptionScope), OutputType(typeof(PSBlueprintAssignment))] public class GetAzureRmBlueprintAssignment : BlueprintAssignmentCmdletBase { #region Parameters - [Parameter(ParameterSetName = ParameterSetNames.BlueprintAssignmentByName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.BlueprintAssignmentName)] + [Parameter(ParameterSetName = ParameterSetNames.BySubscriptionAndName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.BlueprintAssignmentName)] + [Parameter(ParameterSetName = ParameterSetNames.ByManagementGroupAndName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.BlueprintAssignmentName)] [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(ParameterSetName = ParameterSetNames.BlueprintAssignmentByName, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.AssignmentSubscriptionId)] - [Parameter(ParameterSetName = ParameterSetNames.BlueprintAssignmentsBySubscription, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.AssignmentSubscriptionId)] + [Parameter(ParameterSetName = ParameterSetNames.BySubscriptionAndName, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.AssignmentSubscriptionId)] + [Parameter(ParameterSetName = ParameterSetNames.SubscriptionScope, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.AssignmentSubscriptionId)] [ValidateNotNullOrEmpty] public string SubscriptionId { get; set; } + + [Parameter(ParameterSetName = ParameterSetNames.ByManagementGroupAndName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.AssignmentManagementGroupId)] + [Parameter(ParameterSetName = ParameterSetNames.ManagementGroupScope, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.AssignmentManagementGroupId)] + [ValidateNotNullOrEmpty] + public string ManagementGroupId { get; set; } #endregion #region Cmdlet Overrides @@ -42,11 +48,18 @@ public override void ExecuteCmdlet() try { switch (ParameterSetName) { - case ParameterSetNames.BlueprintAssignmentsBySubscription: + case ParameterSetNames.ManagementGroupScope: + foreach (var assignment in BlueprintClient.ListBlueprintAssignments(Utils.GetScopeForManagementGroup(ManagementGroupId))) + WriteObject(assignment, true); + break; + case ParameterSetNames.SubscriptionScope: foreach (var assignment in BlueprintClient.ListBlueprintAssignments(Utils.GetScopeForSubscription(subscription))) WriteObject(assignment, true); break; - case ParameterSetNames.BlueprintAssignmentByName: + case ParameterSetNames.ByManagementGroupAndName: + WriteObject(BlueprintClient.GetBlueprintAssignment(Utils.GetScopeForManagementGroup(ManagementGroupId), Name)); + break; + case ParameterSetNames.BySubscriptionAndName: WriteObject(BlueprintClient.GetBlueprintAssignment(Utils.GetScopeForSubscription(subscription), Name)); break; default: diff --git a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/NewAzureRMBlueprintAssignment.cs b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/NewAzureRMBlueprintAssignment.cs index dcb016d4e759..57a5351be8d2 100644 --- a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/NewAzureRMBlueprintAssignment.cs +++ b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/NewAzureRMBlueprintAssignment.cs @@ -62,7 +62,7 @@ public class NewAzureRmBlueprintAssignment : BlueprintAssignmentCmdletBase [ValidateNotNullOrEmpty] public Hashtable SecureStringParameter { get; set; } - [Parameter(ParameterSetName = ParameterSetNames.CreateBlueprintAssignment, Mandatory = false, ValueFromPipelineByPropertyName = true)] + [Parameter(ParameterSetName = ParameterSetNames.CreateBlueprintAssignment, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = BlueprintConstants.ParameterHelpMessages.ResourceGroupParameters)] [ValidateNotNullOrEmpty] public Hashtable ResourceGroupParameter { get; set; } @@ -70,10 +70,14 @@ public class NewAzureRmBlueprintAssignment : BlueprintAssignmentCmdletBase [ValidateNotNull] public Hashtable Parameter { get; set; } - [Parameter(ParameterSetName = ParameterSetNames.CreateBlueprintAssignmentByFile, Mandatory = false, HelpMessage = BlueprintConstants.ParameterHelpMessages.SecureString)] + [Parameter(ParameterSetName = ParameterSetNames.CreateBlueprintAssignmentByFile, Mandatory = false, HelpMessage = BlueprintConstants.ParameterHelpMessages.AssignmentFile)] [ValidateNotNullOrEmpty] public string AssignmentFile { get; set; } + [Parameter(ParameterSetName = ParameterSetNames.CreateBlueprintAssignmentByFile, Mandatory = false, HelpMessage = BlueprintConstants.ParameterHelpMessages.ManagementGroupIdToAssign)] + [Parameter(ParameterSetName = ParameterSetNames.CreateBlueprintAssignment, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = BlueprintConstants.ParameterHelpMessages.ManagementGroupIdToAssign)] + public string ManagementGroupId { get; set; } + [Parameter(ParameterSetName = ParameterSetNames.CreateBlueprintAssignmentByFile, Mandatory = false, HelpMessage = BlueprintConstants.ParameterHelpMessages.SubscriptionIdToAssign)] [Parameter(ParameterSetName = ParameterSetNames.CreateBlueprintAssignment, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = BlueprintConstants.ParameterHelpMessages.SubscriptionIdToAssign)] [ValidateNotNullOrEmpty] @@ -87,12 +91,12 @@ public override void ExecuteCmdlet() { Utils.ValidateName(Name); - var subscriptionsList = SubscriptionId ?? new[] { DefaultContext.Subscription.Id }; + var subscriptionIds = SubscriptionId ?? new[] { DefaultContext.Subscription.Id }; switch (ParameterSetName) { case ParameterSetNames.CreateBlueprintAssignment: - if (ShouldProcess(string.Join(",", subscriptionsList), string.Format(Resources.CreateAssignmentShouldProcessString, Name))) + if (ShouldProcess(string.Join(",", subscriptionIds), string.Format(Resources.CreateAssignmentShouldProcessString, Name))) { var assignment = CreateAssignmentObject( this.IsParameterBound(c => c.UserAssignedIdentity) @@ -108,30 +112,35 @@ public override void ExecuteCmdlet() ResourceGroupParameter, SecureStringParameter); - foreach (var subscription in subscriptionsList) + foreach (var subscriptionId in subscriptionIds) { - var scope = Utils.GetScopeForSubscription(subscription); - ThrowIfAssignmentExists(scope, Name); + string targetScope = Utils.GetScopeForSubscription(subscriptionId); + string resourceScope = !string.IsNullOrEmpty(this.ManagementGroupId) + ? Utils.GetScopeForManagementGroup(this.ManagementGroupId) + : targetScope; + + ThrowIfAssignmentExists(resourceScope, Name); // Register Blueprint RP - RegisterBlueprintRp(subscription); + RegisterBlueprintRp(subscriptionId); if (!this.IsParameterBound(c => c.UserAssignedIdentity)) { - var spnObjectId = GetBlueprintSpn(scope, Name); - AssignOwnerPermission(subscription, spnObjectId); + var spnObjectId = GetBlueprintSpn(resourceScope, Name); + AssignOwnerPermission(resourceScope, spnObjectId); } - WriteObject(BlueprintClient.CreateOrUpdateBlueprintAssignment(scope, Name, assignment)); + assignment.Scope = targetScope; + WriteObject(BlueprintClient.CreateOrUpdateBlueprintAssignment(resourceScope, Name, assignment)); } } break; case ParameterSetNames.CreateBlueprintAssignmentByFile: - if (ShouldProcess(string.Join(",", subscriptionsList), string.Format(Resources.CreateAssignmentShouldProcessString, Name))) + if (ShouldProcess(string.Join(",", subscriptionIds), string.Format(Resources.CreateAssignmentShouldProcessString, Name))) { var parametersFilePath = GetValidatedFilePath(AssignmentFile); - foreach (var subscription in subscriptionsList) + foreach (var subscriptionId in subscriptionIds) { Assignment assignmentObject; try @@ -146,10 +155,14 @@ public override void ExecuteCmdlet() ex.Message)); } - var scope = Utils.GetScopeForSubscription(subscription); - ThrowIfAssignmentExists(scope, Name); + string targetScope = Utils.GetScopeForSubscription(subscriptionId); + string resourceScope = !string.IsNullOrEmpty(this.ManagementGroupId) + ? Utils.GetScopeForManagementGroup(this.ManagementGroupId) + : targetScope; + + ThrowIfAssignmentExists(resourceScope, Name); // Register Blueprint RP - RegisterBlueprintRp(subscription); + RegisterBlueprintRp(subscriptionId); if (!IsUserAssignedIdentity(assignmentObject.Identity)) { @@ -160,11 +173,12 @@ public override void ExecuteCmdlet() // System assigned identity. // This is a no-op for user assigned identity. - var spnObjectId = GetBlueprintSpn(scope, Name); - AssignOwnerPermission(subscription, spnObjectId); + var spnObjectId = GetBlueprintSpn(resourceScope, Name); + AssignOwnerPermission(resourceScope, spnObjectId); } - WriteObject(BlueprintClient.CreateOrUpdateBlueprintAssignment(scope, Name, assignmentObject)); + assignmentObject.Scope = targetScope; + WriteObject(BlueprintClient.CreateOrUpdateBlueprintAssignment(resourceScope, Name, assignmentObject)); } } diff --git a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/RemoveAzureRMBlueprintAssignment.cs b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/RemoveAzureRMBlueprintAssignment.cs index c7e74854d6f3..a7a8938488b6 100644 --- a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/RemoveAzureRMBlueprintAssignment.cs +++ b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/RemoveAzureRMBlueprintAssignment.cs @@ -22,20 +22,24 @@ namespace Microsoft.Azure.Commands.Blueprint.Cmdlets { - [Cmdlet(VerbsCommon.Remove, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "BlueprintAssignment", SupportsShouldProcess = true, DefaultParameterSetName = ParameterSetNames.DeleteBlueprintAssignmentByName), OutputType(typeof(PSBlueprintAssignment))] + [Cmdlet(VerbsCommon.Remove, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "BlueprintAssignment", SupportsShouldProcess = true, DefaultParameterSetName = ParameterSetNames.BySubscriptionAndName), OutputType(typeof(PSBlueprintAssignment))] public class RemoveAzureRmBlueprintAssignment : BlueprintAssignmentCmdletBase { #region Parameters - [Parameter(ParameterSetName = ParameterSetNames.DeleteBlueprintAssignmentByName, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.BlueprintAssignmentName)] + [Parameter(ParameterSetName = ParameterSetNames.BySubscriptionAndName, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.BlueprintAssignmentName)] + [Parameter(ParameterSetName = ParameterSetNames.ByManagementGroupAndName, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.BlueprintAssignmentName)] [ValidateNotNullOrEmpty] public string Name { get; set; } - [Parameter(ParameterSetName = ParameterSetNames.DeleteBlueprintAssignmentByObject, Position = 0, Mandatory = false, ValueFromPipeline = true, HelpMessage = ParameterHelpMessages.AssignmentSubscriptionId)] - [Parameter(ParameterSetName = ParameterSetNames.DeleteBlueprintAssignmentByName, Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.AssignmentSubscriptionId)] + [Parameter(ParameterSetName = ParameterSetNames.BySubscriptionAndName, Position = 0, Mandatory = false, ValueFromPipeline = true, HelpMessage = ParameterHelpMessages.AssignmentSubscriptionId)] [ValidateNotNullOrEmpty] public string SubscriptionId { get; set; } - [Parameter(ParameterSetName = ParameterSetNames.DeleteBlueprintAssignmentByObject, Position = 1, Mandatory = true, ValueFromPipeline = true, HelpMessage = ParameterHelpMessages.BlueprintAssignmentObject)] + [Parameter(ParameterSetName = ParameterSetNames.ByManagementGroupAndName, Position = 0, Mandatory = true, ValueFromPipeline = true, HelpMessage = ParameterHelpMessages.AssignmentManagementGroupId)] + [ValidateNotNullOrEmpty] + public string ManagementGroupId { get; set; } + + [Parameter(ParameterSetName = ParameterSetNames.DeleteBlueprintAssignmentByObject, Mandatory = true, ValueFromPipeline = true, HelpMessage = ParameterHelpMessages.BlueprintAssignmentObject)] public PSBlueprintAssignment InputObject { get; set; } [Parameter(Mandatory = false)] @@ -49,7 +53,18 @@ public override void ExecuteCmdlet() { switch (ParameterSetName) { - case ParameterSetNames.DeleteBlueprintAssignmentByName: + case ParameterSetNames.ByManagementGroupAndName: + if (ShouldProcess(ManagementGroupId, string.Format(Resources.DeleteAssignmentShouldProcessString, Name))) + { + var deletedAssignment = BlueprintClient.DeleteBlueprintAssignment(Utils.GetScopeForManagementGroup(ManagementGroupId), Name); + + if (deletedAssignment != null && PassThru.IsPresent) + { + WriteObject(deletedAssignment); + } + } + break; + case ParameterSetNames.BySubscriptionAndName: var subscription = SubscriptionId ?? DefaultContext.Subscription.Id; diff --git a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/SetAzureRMBlueprintAssignment.cs b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/SetAzureRMBlueprintAssignment.cs index b8092cfe2d20..f6c38b5ea466 100644 --- a/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/SetAzureRMBlueprintAssignment.cs +++ b/src/Blueprint/Blueprint/Cmdlets/BlueprintAssignment/SetAzureRMBlueprintAssignment.cs @@ -64,7 +64,7 @@ public class SetAzureRMBlueprintAssignment : BlueprintAssignmentCmdletBase [ValidateNotNullOrEmpty] public Hashtable SecureStringParameter { get; set; } - [Parameter(ParameterSetName = ParameterSetNames.UpdateBlueprintAssignment, Mandatory = false, ValueFromPipelineByPropertyName = true)] + [Parameter(ParameterSetName = ParameterSetNames.UpdateBlueprintAssignment, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.ResourceGroupParameters)] [ValidateNotNullOrEmpty] public Hashtable ResourceGroupParameter { get; set; } @@ -72,10 +72,14 @@ public class SetAzureRMBlueprintAssignment : BlueprintAssignmentCmdletBase [ValidateNotNull] public Hashtable Parameter { get; set; } - [Parameter(ParameterSetName = ParameterSetNames.UpdateBlueprintAssignmentByFile, Mandatory = false, HelpMessage = ParameterHelpMessages.SecureString)] + [Parameter(ParameterSetName = ParameterSetNames.UpdateBlueprintAssignmentByFile, Mandatory = false, HelpMessage = ParameterHelpMessages.AssignmentFile)] [ValidateNotNullOrEmpty] public string AssignmentFile { get; set; } + [Parameter(ParameterSetName = ParameterSetNames.UpdateBlueprintAssignmentByFile, Mandatory = false, HelpMessage = ParameterHelpMessages.ManagementGroupIdToAssign)] + [Parameter(ParameterSetName = ParameterSetNames.UpdateBlueprintAssignment, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.ManagementGroupIdToAssign)] + public string ManagementGroupId { get; set; } + [Parameter(ParameterSetName = ParameterSetNames.UpdateBlueprintAssignmentByFile, Mandatory = false, HelpMessage = ParameterHelpMessages.SubscriptionIdToAssign)] [Parameter(ParameterSetName = ParameterSetNames.UpdateBlueprintAssignment, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.SubscriptionIdToAssign)] [ValidateNotNullOrEmpty] @@ -85,15 +89,17 @@ public class SetAzureRMBlueprintAssignment : BlueprintAssignmentCmdletBase #region Cmdlet Overrides public override void ExecuteCmdlet() { + Utils.ValidateName(this.Name); + try { - var subscriptionsList = SubscriptionId ?? new[] { DefaultContext.Subscription.Id }; + var subscriptionIds = SubscriptionId ?? new[] { DefaultContext.Subscription.Id }; switch (ParameterSetName) { case ParameterSetNames.UpdateBlueprintAssignment: - if (ShouldProcess(string.Join(",", subscriptionsList), + if (ShouldProcess(string.Join(",", subscriptionIds), string.Format(Resources.UpdateAssignmentShouldProcessString, Name))) { var assignment = CreateAssignmentObject( @@ -110,31 +116,36 @@ public override void ExecuteCmdlet() ResourceGroupParameter, SecureStringParameter); - foreach (var subscription in subscriptionsList) + foreach (var subscriptionId in subscriptionIds) { - var scope = Utils.GetScopeForSubscription(subscription); - ThrowIfAssignmentNotExist(scope, Name); + string targetScope = Utils.GetScopeForSubscription(subscriptionId); + string resourceScope = !string.IsNullOrEmpty(this.ManagementGroupId) + ? Utils.GetScopeForManagementGroup(this.ManagementGroupId) + : targetScope; + + ThrowIfAssignmentNotExist(resourceScope, Name); // Register Blueprint RP - RegisterBlueprintRp(subscription); + RegisterBlueprintRp(subscriptionId); if (!this.IsParameterBound(c => c.UserAssignedIdentity)) { - var spnObjectId = GetBlueprintSpn(scope, Name); - AssignOwnerPermission(subscription, spnObjectId); + var spnObjectId = GetBlueprintSpn(resourceScope, Name); + AssignOwnerPermission(resourceScope, spnObjectId); } - WriteObject(BlueprintClient.CreateOrUpdateBlueprintAssignment(scope, Name, assignment)); + assignment.Scope = targetScope; + WriteObject(BlueprintClient.CreateOrUpdateBlueprintAssignment(resourceScope, Name, assignment)); } } break; case ParameterSetNames.UpdateBlueprintAssignmentByFile: - if (ShouldProcess(string.Join(",", subscriptionsList), + if (ShouldProcess(string.Join(",", subscriptionIds), string.Format(Resources.UpdateAssignmentShouldProcessString, Name))) { var parametersFilePath = GetValidatedFilePath(AssignmentFile); - foreach (var subscription in subscriptionsList) + foreach (var subscriptionId in subscriptionIds) { Assignment assignmentObject; try @@ -148,10 +159,14 @@ public override void ExecuteCmdlet() throw new Exception("Can't deserialize the JSON file: " + parametersFilePath + ". " + ex.Message); } - var scope = Utils.GetScopeForSubscription(subscription); - ThrowIfAssignmentNotExist(scope, Name); + string targetScope = Utils.GetScopeForSubscription(subscriptionId); + string resourceScope = !string.IsNullOrEmpty(this.ManagementGroupId) + ? Utils.GetScopeForManagementGroup(this.ManagementGroupId) + : targetScope; + + ThrowIfAssignmentNotExist(resourceScope, Name); // Register Blueprint RP - RegisterBlueprintRp(subscription); + RegisterBlueprintRp(subscriptionId); if (!IsUserAssignedIdentity(assignmentObject.Identity)) { @@ -162,11 +177,12 @@ public override void ExecuteCmdlet() // System assigned identity. // This is a no-op for user assigned identity. - var spnObjectId = GetBlueprintSpn(scope, Name); - AssignOwnerPermission(subscription, spnObjectId); + var spnObjectId = GetBlueprintSpn(resourceScope, Name); + AssignOwnerPermission(resourceScope, spnObjectId); } - WriteObject(BlueprintClient.CreateOrUpdateBlueprintAssignment(scope, Name, assignmentObject)); + assignmentObject.Scope = targetScope; + WriteObject(BlueprintClient.CreateOrUpdateBlueprintAssignment(resourceScope, Name, assignmentObject)); } } break; diff --git a/src/Blueprint/Blueprint/Common/BlueprintClient.cs b/src/Blueprint/Blueprint/Common/BlueprintClient.cs index d32ecb526d40..5e2863272ac9 100644 --- a/src/Blueprint/Blueprint/Common/BlueprintClient.cs +++ b/src/Blueprint/Blueprint/Common/BlueprintClient.cs @@ -67,11 +67,11 @@ public PSBlueprint GetBlueprint(string scope, string blueprintName) return PSBlueprint.FromBlueprintModel(result.Body, scope); } - public PSBlueprintAssignment GetBlueprintAssignment(string subscriptionId, string blueprintAssignmentName) + public PSBlueprintAssignment GetBlueprintAssignment(string scope, string blueprintAssignmentName) { - var result = blueprintManagementClient.Assignments.GetWithHttpMessagesAsync(subscriptionId, blueprintAssignmentName).GetAwaiter().GetResult(); + var result = blueprintManagementClient.Assignments.GetWithHttpMessagesAsync(scope, blueprintAssignmentName).GetAwaiter().GetResult(); - return PSBlueprintAssignment.FromAssignment(result.Body, subscriptionId); + return PSBlueprintAssignment.FromAssignment(result.Body); } public PSBlueprint DeleteBlueprint(string scope, string blueprintName) @@ -102,11 +102,11 @@ public PSPublishedBlueprint GetLatestPublishedBlueprint(string scope, string blu return latest; } - public IEnumerable ListBlueprintAssignments(string subscriptionId) + public IEnumerable ListBlueprintAssignments(string scope) { - var assignments = blueprintManagementClient.Assignments.List(subscriptionId); + var assignments = blueprintManagementClient.Assignments.List(scope); - foreach (var assignment in assignments.Select(assignment => PSBlueprintAssignment.FromAssignment(assignment, subscriptionId))) + foreach (var assignment in assignments.Select(assignment => PSBlueprintAssignment.FromAssignment(assignment))) { yield return assignment; } @@ -114,7 +114,7 @@ public IEnumerable ListBlueprintAssignments(string subscr while (!string.IsNullOrEmpty(assignments.NextPageLink)) { assignments = blueprintManagementClient.Assignments.ListNext(assignments.NextPageLink); - foreach (var assignment in assignments.Select(assignment => PSBlueprintAssignment.FromAssignment(assignment, subscriptionId))) + foreach (var assignment in assignments.Select(assignment => PSBlueprintAssignment.FromAssignment(assignment))) { yield return assignment; } @@ -189,23 +189,23 @@ private IEnumerable ListPublishedBlueprints(string scope, return list; } - public PSBlueprintAssignment DeleteBlueprintAssignment(string subscriptionId, string blueprintAssignmentName) + public PSBlueprintAssignment DeleteBlueprintAssignment(string scope, string blueprintAssignmentName) { - var result = blueprintManagementClient.Assignments.DeleteWithHttpMessagesAsync(subscriptionId, blueprintAssignmentName).GetAwaiter().GetResult(); + var result = blueprintManagementClient.Assignments.DeleteWithHttpMessagesAsync(scope, blueprintAssignmentName).GetAwaiter().GetResult(); if (result.Body == null) return null; - return PSBlueprintAssignment.FromAssignment(result.Body, subscriptionId); + return PSBlueprintAssignment.FromAssignment(result.Body); } - public PSBlueprintAssignment CreateOrUpdateBlueprintAssignment(string subscriptionId, string assignmentName, Assignment assignment) + public PSBlueprintAssignment CreateOrUpdateBlueprintAssignment(string scope, string assignmentName, Assignment assignment) { - var result = blueprintManagementClient.Assignments.CreateOrUpdateWithHttpMessagesAsync(subscriptionId, assignmentName, assignment).GetAwaiter().GetResult(); + var result = blueprintManagementClient.Assignments.CreateOrUpdateWithHttpMessagesAsync(scope, assignmentName, assignment).GetAwaiter().GetResult(); if (result.Body != null) { - return PSBlueprintAssignment.FromAssignment(result.Body, subscriptionId); + return PSBlueprintAssignment.FromAssignment(result.Body); } return null; diff --git a/src/Blueprint/Blueprint/Common/BlueprintConstants.cs b/src/Blueprint/Blueprint/Common/BlueprintConstants.cs index e0e89c24cfa7..82595728e6fa 100644 --- a/src/Blueprint/Blueprint/Common/BlueprintConstants.cs +++ b/src/Blueprint/Blueprint/Common/BlueprintConstants.cs @@ -36,15 +36,11 @@ public static class ParameterSetNames public const string ByManagementGroupNameAndVersion = "ByManagementGroupNameAndVersion"; public const string ByManagementGroupNameAndLatestPublished = "ByManagementGroupNameAndLatestPublished"; - public const string BlueprintAssignmentsBySubscription = "BlueprintAssignmentsBySubscription"; - public const string BlueprintAssignmentByName = "BlueprintAssignmentByName"; public const string CreateBlueprintAssignment = "CreateBlueprintAssignment"; public const string CreateBlueprintAssignmentByFile = "CreateBlueprintAssignmentByFile"; - public const string DeleteBlueprintAssignmentByName = "DeleteBlueprintAssignmentByName"; - public const string DeleteBlueprintAssignmentByObject = "DeleteBlueprintAssignmentByObject"; - public const string UpdateBlueprintAssignment = "UpdateBlueprintAssignment"; public const string UpdateBlueprintAssignmentByFile = "UpdateBlueprintAssignmentByFile"; + public const string DeleteBlueprintAssignmentByObject = "DeleteBlueprintAssignmentByObject"; public const string PublishBlueprint = "PublishBlueprint"; @@ -77,6 +73,7 @@ public static class ParameterHelpMessages { public const string DefinitionSubscriptionId = "Subscription Id where the blueprint definition is or will be saved."; public const string AssignmentSubscriptionId = "Subscription Id the blueprint assignment is deployed to."; + public const string AssignmentManagementGroupId = "The ID of the management group where the Blueprint assignment is saved."; public const string BlueprintAssignmentName = "Blueprint assignment name."; public const string BlueprintAssignmentObject = "Blueprint assignment object."; public const string BlueprintObject = "Blueprint object."; @@ -85,7 +82,8 @@ public static class ParameterHelpMessages public const string BlueprintDefinitionVersion = "Published blueprint definition version."; public const string BlueprintDefinitionVersionToPublish = "Version for the blueprint definition."; public const string LatestPublishedFlag = "The latest published blueprint definition flag. When set, execution returns the latest published version of the blueprint definition."; - public const string SubscriptionIdToAssign = "SubscriptionId to assign the Blueprint. Can be a comma delimited list of subscriptionId strings."; + public const string ManagementGroupIdToAssign = "The ID of the management group where the Blueprint assignment(s) will be saved."; + public const string SubscriptionIdToAssign = "SubscriptionId to assign the Blueprint. Can be a comma delimited list of subscriptionId strings. For management group level assignment, make sure the subscriptions are direct children of the management group specified with -ManagementGroupId."; public const string Location = "Region for managed identity to be created in. Learn more at aka.ms/blueprintmsi"; public const string Parameters = "Collection of key/value pairs for parameters and their corresponding values."; public const string LockFlag = "Lock resources. Learn more at aka.ms/blueprintlocks"; @@ -93,6 +91,8 @@ public static class ParameterHelpMessages public const string SystemAssignedIdentity = "System assigned identity(MSI) to deploy the artifacts."; public const string UserAssignedIdentity = "User assigned identity(MSI) to deploy the artifacts."; public const string SecureString = "Secure string parameter for KeyVault resource id, name and version."; + public const string ResourceGroupParameters = "Hashtable of parameters to pass to the resource group artifact."; + public const string AssignmentFile = "Location of the assignment file in JSON format on disk."; public const string ArtifactName = "Name of the artifact"; public const string ArtifactType = "Type of the artifact. There are 3 types supported: RoleAssignmentArtifact, PolicyAssignmentArtifact, TemplateArtifact."; public const string ArtifactDescription = "Description of the artifact."; diff --git a/src/Blueprint/Blueprint/Common/IBlueprintClient.cs b/src/Blueprint/Blueprint/Common/IBlueprintClient.cs index 95016c136230..069dfbb262f0 100644 --- a/src/Blueprint/Blueprint/Common/IBlueprintClient.cs +++ b/src/Blueprint/Blueprint/Common/IBlueprintClient.cs @@ -30,13 +30,13 @@ public interface IBlueprintClient PSPublishedBlueprint GetLatestPublishedBlueprint(string scope, string blueprintName); - IEnumerable ListBlueprintAssignments(string subscriptionId); + IEnumerable ListBlueprintAssignments(string scope); - PSBlueprintAssignment GetBlueprintAssignment(string subscriptionId, string blueprintAssignmentName); + PSBlueprintAssignment GetBlueprintAssignment(string scope, string blueprintAssignmentName); - PSBlueprintAssignment DeleteBlueprintAssignment(string subscriptionId, string blueprintAssignmentName); + PSBlueprintAssignment DeleteBlueprintAssignment(string scope, string blueprintAssignmentName); - PSBlueprintAssignment CreateOrUpdateBlueprintAssignment(string subscriptionId, string assignmentName, Assignment assignment); + PSBlueprintAssignment CreateOrUpdateBlueprintAssignment(string scope, string assignmentName, Assignment assignment); PSBlueprint CreateOrUpdateBlueprint(string scope, string name, BlueprintModel bp); diff --git a/src/Blueprint/Blueprint/Models/PSBlueprintAssignment.cs b/src/Blueprint/Blueprint/Models/PSBlueprintAssignment.cs index fbab05eeec4b..23ae937d358a 100644 --- a/src/Blueprint/Blueprint/Models/PSBlueprintAssignment.cs +++ b/src/Blueprint/Blueprint/Models/PSBlueprintAssignment.cs @@ -26,7 +26,7 @@ public class PSBlueprintAssignment : PSAzureResourceBase public string DisplayName { get; set; } public string Description { get; set; } public string BlueprintId { get; set; } - public IDictionary Parameters { get; set; } + public IDictionary Parameters { get; set; } public IDictionary ResourceGroups { get; set; } public PSAssignmentStatus Status { get; set; } public PSAssignmentLockSettings Locks { get; set; } @@ -38,7 +38,7 @@ public class PSBlueprintAssignment : PSAzureResourceBase /// Assignment object from which to create the PSBlueprintAssignment. /// ID of the subscription the assignment is associated with. /// A new PSBlueprintAssignment object. - internal static PSBlueprintAssignment FromAssignment(Assignment assignment, string scope) + internal static PSBlueprintAssignment FromAssignment(Assignment assignment) { var psAssignment = new PSBlueprintAssignment { @@ -46,7 +46,7 @@ internal static PSBlueprintAssignment FromAssignment(Assignment assignment, stri Id = assignment.Id, Type = assignment.Type, Location = assignment.Location, - Scope = scope, + Scope = assignment.Scope, Identity = new PSManagedServiceIdentity { PrincipalId = assignment.Identity.PrincipalId, @@ -60,7 +60,7 @@ internal static PSBlueprintAssignment FromAssignment(Assignment assignment, stri ProvisioningState = PSAssignmentProvisioningState.Unknown, Status = new PSAssignmentStatus(), Locks = new PSAssignmentLockSettings {Mode = PSLockMode.None}, - Parameters = new Dictionary(), + Parameters = new Dictionary(), ResourceGroups = new Dictionary() }; @@ -88,7 +88,7 @@ internal static PSBlueprintAssignment FromAssignment(Assignment assignment, stri foreach (var item in assignment.Parameters) { - PSParameterValueBase parameter = GetAssignmentParameters(item); + PSParameterValue parameter = GetAssignmentParameters(item); psAssignment.Parameters.Add(item.Key, parameter); } @@ -110,20 +110,20 @@ internal static PSBlueprintAssignment FromAssignment(Assignment assignment, stri return psAssignment; } - private static PSParameterValueBase GetAssignmentParameters(KeyValuePair parameterKvp) + private static PSParameterValue GetAssignmentParameters(KeyValuePair parameterKvp) { - PSParameterValueBase parameter = null; + PSParameterValue parameter = null; - if (parameterKvp.Value != null && parameterKvp.Value is ParameterValue) + if (parameterKvp.Value?.Value != null) { // Need to cast as ParameterValue since assignment.Parameters value type is ParameterValueBase. - var parameterValue = (ParameterValue) parameterKvp.Value; + var parameterValue = parameterKvp.Value; - parameter = new PSParameterValue { Description = parameterValue.Description, Value = parameterValue.Value }; + parameter = new PSParameterValue { Value = parameterValue.Value }; } - else if (parameterKvp.Value != null && parameterKvp.Value is SecretReferenceParameterValue) + else if (parameterKvp.Value?.Reference != null) { - var parameterValue = (SecretReferenceParameterValue) parameterKvp.Value; + var parameterValue = parameterKvp.Value; var secretReference = new PSSecretValueReference { @@ -132,7 +132,7 @@ private static PSParameterValueBase GetAssignmentParameters(KeyValuePair DependsOn { get; set; } public string PolicyDefinitionId { get; set; } - public IDictionary Parameters { get; set; } + public IDictionary Parameters { get; set; } public string ResourceGroup { get; set; } internal static PSPolicyAssignmentArtifact FromArtifactModel(PolicyAssignmentArtifact artifact, string scope) @@ -38,13 +38,13 @@ internal static PSPolicyAssignmentArtifact FromArtifactModel(PolicyAssignmentArt Description = artifact.Description, PolicyDefinitionId = artifact.PolicyDefinitionId, DependsOn = new List(), - Parameters = new Dictionary(), + Parameters = new Dictionary(), ResourceGroup = artifact.ResourceGroup }; foreach (var item in artifact.Parameters) { - PSParameterValueBase parameter = GetArtifactParameters(item); + PSParameterValue parameter = GetArtifactParameters(item); psArtifact.Parameters.Add(item.Key, parameter); } @@ -52,21 +52,18 @@ internal static PSPolicyAssignmentArtifact FromArtifactModel(PolicyAssignmentArt return psArtifact; } - private static PSParameterValueBase GetArtifactParameters(KeyValuePair parameterKvp) + private static PSParameterValue GetArtifactParameters(KeyValuePair parameterKvp) { - PSParameterValueBase parameter = null; + PSParameterValue parameter = null; - if (parameterKvp.Value != null && parameterKvp.Value is ParameterValue) + if (parameterKvp.Value?.Value != null) { - // Need to cast as ParameterValue since assignment.Parameters value type is ParameterValueBase. - var parameterValue = (ParameterValue)parameterKvp.Value; - - parameter = new PSParameterValue { Description = parameterValue.Description, Value = parameterValue.Value }; + var parameterValue = parameterKvp.Value; + parameter = new PSParameterValue { Value = parameterValue.Value }; } - else if (parameterKvp.Value != null && parameterKvp.Value is SecretReferenceParameterValue) + else if (parameterKvp.Value?.Reference != null) { - var parameterValue = (SecretReferenceParameterValue)parameterKvp.Value; - + var parameterValue = parameterKvp.Value; var secretReference = new PSSecretValueReference { KeyVault = new PSKeyVaultReference { Id = parameterValue.Reference.KeyVault.Id }, @@ -74,7 +71,7 @@ private static PSParameterValueBase GetArtifactParameters(KeyValuePair DependsOn { get; set; } public object Template { get; set; } - public IDictionary Parameters { get; set; } + public IDictionary Parameters { get; set; } public string ResourceGroup { get; set; } internal static PSTemplateArtifact FromArtifactModel(TemplateArtifact artifact, string scope) @@ -38,13 +38,13 @@ internal static PSTemplateArtifact FromArtifactModel(TemplateArtifact artifact, Description = artifact.Description, DependsOn = new List(), Template = artifact.Template, - Parameters = new Dictionary(), + Parameters = new Dictionary(), ResourceGroup = artifact.ResourceGroup }; foreach (var item in artifact.Parameters) { - PSParameterValueBase parameter = GetArtifactParameters(item); + PSParameterValue parameter = GetArtifactParameters(item); psArtifact.Parameters.Add(item.Key, parameter); } @@ -52,16 +52,16 @@ internal static PSTemplateArtifact FromArtifactModel(TemplateArtifact artifact, return psArtifact; } - private static PSParameterValueBase GetArtifactParameters(KeyValuePair parameterKvp) + + private static PSParameterValue GetArtifactParameters(KeyValuePair parameterKvp) { - PSParameterValueBase parameter = null; + PSParameterValue parameter = null; - if (parameterKvp.Value != null && parameterKvp.Value is ParameterValue) + if (parameterKvp.Value != null) { - // Need to cast as ParameterValue since assignment.Parameters value type is ParameterValueBase. - var parameterValue = (ParameterValue)parameterKvp.Value; + var parameterValue = parameterKvp.Value; - parameter = new PSParameterValue { Description = parameterValue.Description, Value = parameterValue.Value }; + parameter = new PSParameterValue { Value = parameterValue.Value }; } return parameter; diff --git a/src/Blueprint/Blueprint/Properties/Resources.Designer.cs b/src/Blueprint/Blueprint/Properties/Resources.Designer.cs index 79e78266cf11..4f7eeb8cd8d8 100644 --- a/src/Blueprint/Blueprint/Properties/Resources.Designer.cs +++ b/src/Blueprint/Blueprint/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Blueprint.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -88,7 +88,7 @@ internal static string ArtifactTypeNotSupported { } /// - /// Looks up a localized string similar to An assignment with name '{0}' in subscription '{1}' already exists. Please use Set-AzBlueprintAssignment to update an existing assignment.. + /// Looks up a localized string similar to An assignment with name '{0}' in scope '{1}' already exists. Please use Set-AzBlueprintAssignment to update an existing assignment.. /// internal static string AssignmentExists { get { @@ -97,7 +97,7 @@ internal static string AssignmentExists { } /// - /// Looks up a localized string similar to An assignment with name '{0}' in subscription '{1}' does not exist. Please use New-AzBlueprintAssignment to create a new assignment.. + /// Looks up a localized string similar to An assignment with name '{0}' in scope '{1}' does not exist. Please use New-AzBlueprintAssignment to create a new assignment.. /// internal static string AssignmentNotExist { get { diff --git a/src/Blueprint/Blueprint/Properties/Resources.resx b/src/Blueprint/Blueprint/Properties/Resources.resx index 19ed422f0ba8..208033188d3b 100644 --- a/src/Blueprint/Blueprint/Properties/Resources.resx +++ b/src/Blueprint/Blueprint/Properties/Resources.resx @@ -127,10 +127,10 @@ Artifact type is not supported. - An assignment with name '{0}' in subscription '{1}' already exists. Please use Set-AzBlueprintAssignment to update an existing assignment. + An assignment with name '{0}' in scope '{1}' already exists. Please use Set-AzBlueprintAssignment to update an existing assignment. - An assignment with name '{0}' in subscription '{1}' does not exist. Please use New-AzBlueprintAssignment to create a new assignment. + An assignment with name '{0}' in scope '{1}' does not exist. Please use New-AzBlueprintAssignment to create a new assignment. A blueprint with name '{0}' in subscription '{1}' already exists. Please use Set-AzBlueprint to update an existing blueprint. diff --git a/src/Blueprint/Blueprint/help/Az.Blueprint.md b/src/Blueprint/Blueprint/help/Az.Blueprint.md index 324244635e17..6ea491da6025 100644 --- a/src/Blueprint/Blueprint/help/Az.Blueprint.md +++ b/src/Blueprint/Blueprint/help/Az.Blueprint.md @@ -1,8 +1,8 @@ --- Module Name: Az.Blueprint Module Guid: ef36c942-4a71-4e19-9450-05a35843deb6 -Download Help Link: {{Please enter FwLink manually}} -Help Version: {{Please enter version of help manually (X.X.X.X) format}} +Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.blueprint +Help Version: 1.0.0.0 Locale: en-US --- @@ -18,13 +18,13 @@ Export specified blueprint definition to the specified output location as a JSON Get one or more blueprint definitions. ### [Get-AzBlueprintArtifact](Get-AzBlueprintArtifact.md) -Get artifact from a blueprint definition. +Retrieve artifacts from a blueprint definition. ### [Get-AzBlueprintAssignment](Get-AzBlueprintAssignment.md) Get one or more blueprint assignments. ### [Import-AzBlueprintWithArtifact](Import-AzBlueprintWithArtifact.md) -Import a blueprint definition file in JSON format and save it to a blueprint object within the specified subscription or management group. +Import a blueprint file in JSON format to a blueprint object and save it within the specified subscription or management group. ### [New-AzBlueprint](New-AzBlueprint.md) Create a new blueprint definition and save it within the specified subscription or management group. @@ -33,16 +33,16 @@ Create a new blueprint definition and save it within the specified subscription Create a new artifact and save it within a blueprint definition. ### [New-AzBlueprintAssignment](New-AzBlueprintAssignment.md) -Assign a blueprint definition to a subscription. +Assign a blueprint definition to a subscription or a management group. ### [Publish-AzBlueprint](Publish-AzBlueprint.md) -Publish a new version of a blueprint definition. +Publish a new version of a blueprint. ### [Remove-AzBlueprintAssignment](Remove-AzBlueprintAssignment.md) -Remove a blueprint assignment from a subscription. +Remove a blueprint assignment from a subscription or a management group. ### [Set-AzBlueprint](Set-AzBlueprint.md) -Update a blueprint and save it within the specified subscription or management group. +Update a blueprint definition. ### [Set-AzBlueprintArtifact](Set-AzBlueprintArtifact.md) Update an artifact in a blueprint definition. @@ -50,4 +50,3 @@ Update an artifact in a blueprint definition. ### [Set-AzBlueprintAssignment](Set-AzBlueprintAssignment.md) Update an existing blueprint assignment. - diff --git a/src/Blueprint/Blueprint/help/Export-AzBlueprintWithArtifact.md b/src/Blueprint/Blueprint/help/Export-AzBlueprintWithArtifact.md index f83e4ce79596..63a8367973af 100644 --- a/src/Blueprint/Blueprint/help/Export-AzBlueprintWithArtifact.md +++ b/src/Blueprint/Blueprint/help/Export-AzBlueprintWithArtifact.md @@ -14,7 +14,7 @@ Export specified blueprint definition to the specified output location as a JSON ``` Export-AzBlueprintWithArtifact -Blueprint -OutputPath [-Version ] [-Force] - [-DefaultProfile ] [] + [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -36,7 +36,7 @@ Export a blueprint definition with its artifacts and save to disk. The blueprint definition object to export. ```yaml -Type: PSBlueprintBase +Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase Parameter Sets: (All) Aliases: @@ -51,7 +51,7 @@ Accept wildcard characters: False The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -66,7 +66,7 @@ Accept wildcard characters: False When set to true, execution will not ask for a confirmation. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: @@ -81,7 +81,7 @@ Accept wildcard characters: False Path to a file on disk where to export the Blueprint definition in JSON format. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -92,11 +92,26 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -PassThru +When set, the cmdlet will return an object representing the exported blueprint definition. By default, this cmdlet does not generate any output. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Version Published blueprint definition version. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -107,9 +122,38 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/Get-AzBlueprint.md b/src/Blueprint/Blueprint/help/Get-AzBlueprint.md index 7031fdf194ba..9000c771502a 100644 --- a/src/Blueprint/Blueprint/help/Get-AzBlueprint.md +++ b/src/Blueprint/Blueprint/help/Get-AzBlueprint.md @@ -14,48 +14,48 @@ Get one or more blueprint definitions. ### SubscriptionScope (Default) ``` -Get-AzBlueprint [[-SubscriptionId] ] [-DefaultProfile ] [] +Get-AzBlueprint [-SubscriptionId ] [-DefaultProfile ] [] ``` -### BySubscriptionAndName +### ByManagementGroupNameAndVersion ``` -Get-AzBlueprint [[-SubscriptionId] ] [-Name] [-DefaultProfile ] - [] +Get-AzBlueprint -Name -ManagementGroupId [-Version] + [-DefaultProfile ] [] ``` -### BySubscriptionNameAndVersion +### BySubscriptionAndName ``` -Get-AzBlueprint [[-SubscriptionId] ] [-Name] [-Version] - [-DefaultProfile ] [] +Get-AzBlueprint [-Name ] [-SubscriptionId ] [-DefaultProfile ] + [] ``` -### BySubscriptionNameAndLatestPublished +### ByManagementGroupAndName ``` -Get-AzBlueprint [[-SubscriptionId] ] [-Name] [-LatestPublished] - [-DefaultProfile ] [] +Get-AzBlueprint -Name -ManagementGroupId [-DefaultProfile ] + [] ``` -### ManagementGroupScope +### ByManagementGroupNameAndLatestPublished ``` -Get-AzBlueprint [-ManagementGroupId] [-DefaultProfile ] [] +Get-AzBlueprint -Name -ManagementGroupId [-LatestPublished] + [-DefaultProfile ] [] ``` -### ByManagementGroupAndName +### BySubscriptionNameAndLatestPublished ``` -Get-AzBlueprint [-ManagementGroupId] [-Name] [-DefaultProfile ] - [] +Get-AzBlueprint -Name [-SubscriptionId ] [-LatestPublished] + [-DefaultProfile ] [] ``` -### ByManagementGroupNameAndVersion +### BySubscriptionNameAndVersion ``` -Get-AzBlueprint [-ManagementGroupId] [-Name] [-Version] +Get-AzBlueprint -Name [-SubscriptionId ] [-Version] [-DefaultProfile ] [] ``` -### ByManagementGroupNameAndLatestPublished +### ManagementGroupScope ``` -Get-AzBlueprint [-ManagementGroupId] [-Name] [-LatestPublished] - [-DefaultProfile ] [] +Get-AzBlueprint -ManagementGroupId [-DefaultProfile ] [] ``` ## DESCRIPTION @@ -159,7 +159,7 @@ Defaults to false. ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: BySubscriptionNameAndLatestPublished, ByManagementGroupNameAndLatestPublished +Parameter Sets: ByManagementGroupNameAndLatestPublished, BySubscriptionNameAndLatestPublished Aliases: Required: True @@ -174,11 +174,11 @@ Management Group Id where the blueprint definition is saved. ```yaml Type: System.String -Parameter Sets: ManagementGroupScope, ByManagementGroupAndName, ByManagementGroupNameAndVersion, ByManagementGroupNameAndLatestPublished +Parameter Sets: ByManagementGroupNameAndVersion, ByManagementGroupAndName, ByManagementGroupNameAndLatestPublished, ManagementGroupScope Aliases: Required: True -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -189,11 +189,23 @@ Blueprint definition name. ```yaml Type: System.String -Parameter Sets: BySubscriptionAndName, BySubscriptionNameAndVersion, BySubscriptionNameAndLatestPublished, ByManagementGroupAndName, ByManagementGroupNameAndVersion, ByManagementGroupNameAndLatestPublished +Parameter Sets: ByManagementGroupNameAndVersion, ByManagementGroupAndName, ByManagementGroupNameAndLatestPublished, BySubscriptionNameAndLatestPublished, BySubscriptionNameAndVersion Aliases: Required: True -Position: 0 +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +```yaml +Type: System.String +Parameter Sets: BySubscriptionAndName +Aliases: + +Required: False +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -204,11 +216,11 @@ Subscription Id where the blueprint definition is saved. ```yaml Type: System.String -Parameter Sets: SubscriptionScope, BySubscriptionAndName, BySubscriptionNameAndVersion, BySubscriptionNameAndLatestPublished +Parameter Sets: SubscriptionScope, BySubscriptionAndName, BySubscriptionNameAndLatestPublished, BySubscriptionNameAndVersion Aliases: Required: False -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -219,7 +231,7 @@ Published blueprint definition version. ```yaml Type: System.String -Parameter Sets: BySubscriptionNameAndVersion, ByManagementGroupNameAndVersion +Parameter Sets: ByManagementGroupNameAndVersion, BySubscriptionNameAndVersion Aliases: Required: True @@ -230,7 +242,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/Get-AzBlueprintArtifact.md b/src/Blueprint/Blueprint/help/Get-AzBlueprintArtifact.md index aadcaeb27c45..b018169db58a 100644 --- a/src/Blueprint/Blueprint/help/Get-AzBlueprintArtifact.md +++ b/src/Blueprint/Blueprint/help/Get-AzBlueprintArtifact.md @@ -14,7 +14,7 @@ Retrieve artifacts from a blueprint definition. ``` Get-AzBlueprintArtifact [-Name ] -Blueprint [-BlueprintVersion ] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [] ``` ## DESCRIPTION @@ -47,46 +47,18 @@ ResourceGroup : Id : /providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Blueprint/blueprints/SimpleBlueprint/artifacts/0e1593da-47d5-4b75-800c-9a797dd23192 Type : Microsoft.Blueprint/blueprints/artifacts Name : 0e1593da-47d5-4b75-800c-9a797dd23192 - ``` Retrieve artifacts from a blueprint definition.. ## PARAMETERS -### -ArtifactFile -Location of the artifact file in JSON format on disk. - -```yaml -Type: String -Parameter Sets: CreateArtifactByInputFile -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -Blueprint Blueprint object. ```yaml -Type: PSBlueprintBase -Parameter Sets: ArtifactsByBlueprint, UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - -```yaml -Type: PSBlueprintBase -Parameter Sets: CreateArtifactByInputFile +Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase +Parameter Sets: (All) Aliases: Required: True @@ -100,8 +72,8 @@ Accept wildcard characters: False Version of the blueprint to get the artifacts from. ```yaml -Type: String -Parameter Sets: ArtifactsByBlueprint +Type: System.String +Parameter Sets: (All) Aliases: Required: False @@ -115,7 +87,7 @@ Accept wildcard characters: False The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -126,99 +98,12 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -DependsOn -List of the names of artifacts that needs to be created before current artifact is created. - -```yaml -Type: System.Collections.Generic.List`1[System.String] -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Description -Description of the artifact. - -```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -Name Name of the artifact ```yaml -Type: String -Parameter Sets: ArtifactsByBlueprint -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -```yaml -Type: String -Parameter Sets: CreateArtifactByInputFile, UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -PolicyDefinitionId -Definition Id of the policy definition. - -```yaml -Type: String -Parameter Sets: CreatePolicyArtifact -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -PolicyDefinitionParameter -Hashtable of parameters to pass to the policy definition artifact. - -```yaml -Type: Hashtable -Parameter Sets: CreatePolicyArtifact -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -ResourceGroupName -Name of the resource group the artifact is going to be under. - -```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: System.String +Parameter Sets: (All) Aliases: Required: False @@ -228,117 +113,8 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -RoleDefinitionId -List of role definition - -```yaml -Type: String -Parameter Sets: CreateRoleAssignmentArtifact -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -RoleDefinitionPrincipalId -List of role definition principal ids. - -```yaml -Type: String[] -Parameter Sets: CreateRoleAssignmentArtifact -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -TemplateFile -Location of the ARM template file on disk. - -```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -TemplateParameterFile -Location of the ARM template parameter file on disk. - -```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Type -Type of the artifact. -There are 3 types supported: RoleAssignmentArtifact, PolicyAssignmentArtifact, TemplateArtifact. - -```yaml -Type: PSArtifactKind -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact -Aliases: -Accepted values: RoleAssignmentArtifact, PolicyAssignmentArtifact, TemplateArtifact - -Required: True -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -### -Confirm -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -WhatIf -Shows what would happen if the cmdlet runs. -The cmdlet is not run. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: wi - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/Get-AzBlueprintAssignment.md b/src/Blueprint/Blueprint/help/Get-AzBlueprintAssignment.md index 2f1e3325d444..f9babbfa6a31 100644 --- a/src/Blueprint/Blueprint/help/Get-AzBlueprintAssignment.md +++ b/src/Blueprint/Blueprint/help/Get-AzBlueprintAssignment.md @@ -12,16 +12,28 @@ Get one or more blueprint assignments. ## SYNTAX -### BlueprintAssignmentsBySubscription (Default) +### SubscriptionScope (Default) ``` -Get-AzBlueprintAssignment [[-SubscriptionId] ] [-DefaultProfile ] +Get-AzBlueprintAssignment [-SubscriptionId ] [-DefaultProfile ] [] ``` -### BlueprintAssignmentByName +### BySubscriptionAndName ``` -Get-AzBlueprintAssignment [[-SubscriptionId] ] [-Name] - [-DefaultProfile ] [] +Get-AzBlueprintAssignment -Name [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### ByManagementGroupAndName +``` +Get-AzBlueprintAssignment -Name -ManagementGroupId [-DefaultProfile ] + [] +``` + +### ManagementGroupScope +``` +Get-AzBlueprintAssignment -ManagementGroupId [-DefaultProfile ] + [] ``` ## DESCRIPTION @@ -52,6 +64,20 @@ PS C:\> Get-AzBlueprintAssignment -SubscriptionId "00000000-1111-0000-1111-00000 Get the blueprint assignment with the given name within the specified subscription. +### Example 3 +```powershell +PS C:\> Get-AzBlueprintAssignment -ManagementGroupId "myManagementGroup" +``` + +Get the blueprint assignments within the specified management group. + +### Example 4 +```powershell +PS C:\> Get-AzBlueprintAssignment -ManagementGroupId "myManagementGroup" -Name "myAssignmentName" +``` + +Get the blueprint assignment with the given name within the specified management group. + ## PARAMETERS ### -DefaultProfile @@ -69,16 +95,31 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ManagementGroupId +The ID of the management group where the Blueprint assignment is saved. + +```yaml +Type: System.String +Parameter Sets: ByManagementGroupAndName, ManagementGroupScope +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -Name Blueprint assignment name. ```yaml Type: System.String -Parameter Sets: BlueprintAssignmentByName +Parameter Sets: BySubscriptionAndName, ByManagementGroupAndName Aliases: Required: True -Position: 1 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -89,18 +130,18 @@ Subscription Id the blueprint assignment is deployed to. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: SubscriptionScope, BySubscriptionAndName Aliases: Required: False -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/Import-AzBlueprintWithArtifact.md b/src/Blueprint/Blueprint/help/Import-AzBlueprintWithArtifact.md index 4f46e024ef88..9783ef71dcd2 100644 --- a/src/Blueprint/Blueprint/help/Import-AzBlueprintWithArtifact.md +++ b/src/Blueprint/Blueprint/help/Import-AzBlueprintWithArtifact.md @@ -14,7 +14,8 @@ Import a blueprint file in JSON format to a blueprint object and save it within ``` Import-AzBlueprintWithArtifact -Name [-SubscriptionId ] [-ManagementGroupId ] - -InputPath [-Force] [-DefaultProfile ] [] + -InputPath [-IncludeSubFolders] [-Force] [-PassThru] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -35,7 +36,7 @@ Import a blueprint definition with its artifacts and save within a subscription. The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -50,7 +51,7 @@ Accept wildcard characters: False When set to true, execution will not ask for a confirmation. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: @@ -65,7 +66,7 @@ Accept wildcard characters: False When set to true, artifact in the subfolders will be included. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: @@ -80,7 +81,7 @@ Accept wildcard characters: False Path to a Blueprint JSON file on disk. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -95,7 +96,7 @@ Accept wildcard characters: False Management Group Id where the blueprint definition is or will be saved. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -110,7 +111,7 @@ Accept wildcard characters: False Blueprint definition name. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -121,11 +122,26 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -PassThru +When set, the cmdlet will return an object representing the imported blueprint definition. By default, this cmdlet does not generate any output. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -SubscriptionId Subscription Id where the blueprint definition is or will be saved. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -136,9 +152,38 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/New-AzBlueprint.md b/src/Blueprint/Blueprint/help/New-AzBlueprint.md index 28f4b4cc58db..7a67aadf1ce4 100644 --- a/src/Blueprint/Blueprint/help/New-AzBlueprint.md +++ b/src/Blueprint/Blueprint/help/New-AzBlueprint.md @@ -52,7 +52,7 @@ Create a new blueprint definition within the specified subscription. Path to a Blueprint JSON file on disk. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -67,7 +67,7 @@ Accept wildcard characters: False The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -82,7 +82,7 @@ Accept wildcard characters: False Management Group Id where the blueprint definition is or will be saved. ```yaml -Type: String +Type: System.String Parameter Sets: CreateBlueprintByManagementGroup Aliases: @@ -97,7 +97,7 @@ Accept wildcard characters: False Blueprint definition name. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -112,7 +112,7 @@ Accept wildcard characters: False Subscription Id where the blueprint definition is or will be saved. ```yaml -Type: String +Type: System.String Parameter Sets: CreateBlueprintBySubscription Aliases: @@ -127,7 +127,7 @@ Accept wildcard characters: False Prompts you for confirmation before running the cmdlet. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: cf @@ -143,7 +143,7 @@ Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: wi @@ -155,8 +155,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/New-AzBlueprintArtifact.md b/src/Blueprint/Blueprint/help/New-AzBlueprintArtifact.md index d7da969bc668..f5689a9a731a 100644 --- a/src/Blueprint/Blueprint/help/New-AzBlueprintArtifact.md +++ b/src/Blueprint/Blueprint/help/New-AzBlueprintArtifact.md @@ -5,7 +5,6 @@ online version: https://docs.microsoft.com/en-us/powershell/module/az.blueprint/ schema: 2.0.0 --- - # New-AzBlueprintArtifact ## SYNOPSIS @@ -18,13 +17,13 @@ Create a new artifact and save it within a blueprint definition. New-AzBlueprintArtifact -Name -Type -Blueprint [-Description ] [-DependsOn ] -TemplateParameterFile -TemplateFile [-ResourceGroupName ] - [-DefaultProfile ] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### CreateArtifactByInputFile ``` New-AzBlueprintArtifact -Name -Blueprint -ArtifactFile - [-DefaultProfile ] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### CreateRoleAssignmentArtifact @@ -32,7 +31,7 @@ New-AzBlueprintArtifact -Name -Blueprint -ArtifactFil New-AzBlueprintArtifact -Name -Type -Blueprint [-Description ] [-DependsOn ] -RoleDefinitionId -RoleDefinitionPrincipalId [-ResourceGroupName ] - [-DefaultProfile ] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### CreatePolicyArtifact @@ -40,7 +39,7 @@ New-AzBlueprintArtifact -Name -Type -Blueprint -Type -Blueprint [-Description ] [-DependsOn ] -PolicyDefinitionId -PolicyDefinitionParameter [-ResourceGroupName ] - [-DefaultProfile ] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -83,12 +82,10 @@ Id : /subscriptions/28cbf98f-381d-4425-9ac4-cf342dab9753/provide artifacts/ApplyTag-RG Type : Microsoft.Blueprint/blueprints/artifacts Name : ApplyTag-RG - ``` Create a new artifact through inline parameters. - ### Example 3 ```powershell PS C:\> $bp = Get-AzBlueprint -Name SimpleBlueprint @@ -103,7 +100,6 @@ ResourceGroup : storageRG Id : /subscriptions/{subscriptionId}/providers/Microsoft.Blueprint/blueprints/AppNetwork/artifacts/storage-account Type : Microsoft.Blueprint/blueprints/artifacts Name : storage-account - ``` Create a new artifact through an ARM template file. @@ -114,7 +110,7 @@ Create a new artifact through an ARM template file. Location of the artifact file in JSON format on disk. ```yaml -Type: String +Type: System.String Parameter Sets: CreateArtifactByInputFile Aliases: @@ -129,8 +125,8 @@ Accept wildcard characters: False Blueprint object. ```yaml -Type: PSBlueprintBase -Parameter Sets: UpdateTemplateArtifact, ArtifactsByBlueprint, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase +Parameter Sets: CreateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact Aliases: Required: True @@ -141,7 +137,7 @@ Accept wildcard characters: False ``` ```yaml -Type: PSBlueprintBase +Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase Parameter Sets: CreateArtifactByInputFile Aliases: @@ -156,7 +152,7 @@ Accept wildcard characters: False The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -172,7 +168,7 @@ List of the names of artifacts that needs to be created before current artifact ```yaml Type: System.Collections.Generic.List`1[System.String] -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Parameter Sets: CreateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact Aliases: Required: False @@ -186,8 +182,8 @@ Accept wildcard characters: False Description of the artifact. ```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: System.String +Parameter Sets: CreateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact Aliases: Required: False @@ -201,8 +197,8 @@ Accept wildcard characters: False Name of the artifact ```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact, CreateArtifactByInputFile, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: System.String +Parameter Sets: (All) Aliases: Required: True @@ -212,23 +208,11 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -```yaml -Type: String -Parameter Sets: ArtifactsByBlueprint -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -PolicyDefinitionId Definition Id of the policy definition. ```yaml -Type: String +Type: System.String Parameter Sets: CreatePolicyArtifact Aliases: @@ -243,7 +227,7 @@ Accept wildcard characters: False Hashtable of parameters to pass to the policy definition artifact. ```yaml -Type: Hashtable +Type: System.Collections.Hashtable Parameter Sets: CreatePolicyArtifact Aliases: @@ -258,8 +242,8 @@ Accept wildcard characters: False Name of the resource group the artifact is going to be under. ```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: System.String +Parameter Sets: CreateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact Aliases: Required: False @@ -273,7 +257,7 @@ Accept wildcard characters: False List of role definition ```yaml -Type: String +Type: System.String Parameter Sets: CreateRoleAssignmentArtifact Aliases: @@ -288,7 +272,7 @@ Accept wildcard characters: False List of role definition principal ids. ```yaml -Type: String[] +Type: System.String[] Parameter Sets: CreateRoleAssignmentArtifact Aliases: @@ -303,8 +287,8 @@ Accept wildcard characters: False Location of the ARM template file on disk. ```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact +Type: System.String +Parameter Sets: CreateTemplateArtifact Aliases: Required: True @@ -318,8 +302,8 @@ Accept wildcard characters: False Location of the ARM template parameter file on disk. ```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact +Type: System.String +Parameter Sets: CreateTemplateArtifact Aliases: Required: True @@ -334,8 +318,8 @@ Type of the artifact. There are 3 types supported: RoleAssignmentArtifact, PolicyAssignmentArtifact, TemplateArtifact. ```yaml -Type: PSArtifactKind -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: Microsoft.Azure.Commands.Blueprint.Models.PSArtifactKind +Parameter Sets: CreateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact Aliases: Accepted values: RoleAssignmentArtifact, PolicyAssignmentArtifact, TemplateArtifact @@ -346,9 +330,38 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/New-AzBlueprintAssignment.md b/src/Blueprint/Blueprint/help/New-AzBlueprintAssignment.md index 48117be24b0a..25b2be28207d 100644 --- a/src/Blueprint/Blueprint/help/New-AzBlueprintAssignment.md +++ b/src/Blueprint/Blueprint/help/New-AzBlueprintAssignment.md @@ -8,7 +8,7 @@ schema: 2.0.0 # New-AzBlueprintAssignment ## SYNOPSIS -Assign a blueprint definition to a subscription. +Assign a blueprint definition to a subscription or a management group. ## SYNTAX @@ -17,15 +17,15 @@ Assign a blueprint definition to a subscription. New-AzBlueprintAssignment -Name -Blueprint -Location [-SystemAssignedIdentity] [-UserAssignedIdentity ] [-Lock ] [-SecureStringParameter ] [-ResourceGroupParameter ] [-Parameter ] - [-SubscriptionId ] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] + [-ManagementGroupId ] [-SubscriptionId ] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ### CreateBlueprintAssignmentByFile ``` -New-AzBlueprintAssignment -Name -Blueprint [-AssignmentFile ] - [-SubscriptionId ] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] +New-AzBlueprintAssignment -Name [-Blueprint ] [-AssignmentFile ] + [-ManagementGroupId ] [-SubscriptionId ] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -84,14 +84,37 @@ ResourceGroups : ResourceGroup Create a blueprint assignment through an assignment file. The format of the assignment file can be found in the request/response samples at: https://github.com/Azure/azure-rest-api-specs/tree/master/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples +### Example 5 +```powershell +PS C:\> $blueprintObject = Get-AzBlueprint -SubscriptionId "myManagementGroup" -Name "myBlueprintName" +PS C:\> New-AzBlueprintAssignment -Name "myAssignment" -Blueprint $blueprintObject -ManagementGroupId "myManagementGroup" -SubscriptionId 00000000-1111-0000-1111-000000000000 -Location "West US" -Parameter @{P1="v1"; P2="v2"} +``` + +Create a new blueprint assignment of the blueprint definition `$blueprintObject` targeting the specified subscription within the specified management group using the defined parameter. + ## PARAMETERS +### -AssignmentFile +Location of the assignment file in JSON format on disk. + +```yaml +Type: System.String +Parameter Sets: CreateBlueprintAssignmentByFile +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Blueprint Blueprint definition object. ```yaml Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment Aliases: Required: True @@ -101,6 +124,18 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +```yaml +Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase +Parameter Sets: CreateBlueprintAssignmentByFile +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure. @@ -122,7 +157,7 @@ Learn more at aka.ms/blueprintmsi ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment Aliases: Required: True @@ -138,7 +173,7 @@ Learn more at aka.ms/blueprintlocks ```yaml Type: System.Nullable`1[Microsoft.Azure.Commands.Blueprint.Models.PSLockMode] -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment Aliases: Accepted values: None, AllResourcesReadOnly, AllResourcesDoNotDelete @@ -149,12 +184,51 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ManagementGroupId +The ID of the management group where the Blueprint assignment(s) will be saved. + +```yaml +Type: System.String +Parameter Sets: CreateBlueprintAssignment +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +```yaml +Type: System.String +Parameter Sets: CreateBlueprintAssignmentByFile +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -Name Blueprint assignment name. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +```yaml +Type: System.String +Parameter Sets: CreateBlueprintAssignmentByFile Aliases: Required: True @@ -169,7 +243,7 @@ Artifact parameters. ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment Aliases: Required: False @@ -180,11 +254,11 @@ Accept wildcard characters: False ``` ### -ResourceGroupParameter -{{Fill ResourceGroupParameter Description}} +Hashtable of parameters to pass to the resource group artifact. ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment Aliases: Required: False @@ -199,7 +273,7 @@ Secure string parameter for KeyVault resource id, name and version. ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment Aliases: Required: False @@ -215,7 +289,19 @@ Can be a comma delimited list of subscriptionId strings. ```yaml Type: System.String[] -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +```yaml +Type: System.String[] +Parameter Sets: CreateBlueprintAssignmentByFile Aliases: Required: False @@ -230,7 +316,7 @@ System assigned identity(MSI) to deploy the artifacts. ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment Aliases: Required: False @@ -245,7 +331,7 @@ User assigned identity(MSI) to deploy the artifacts. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: CreateBlueprintAssignment Aliases: Required: False @@ -287,7 +373,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/Publish-AzBlueprint.md b/src/Blueprint/Blueprint/help/Publish-AzBlueprint.md index ba2e9fc2528f..9aa790ddf600 100644 --- a/src/Blueprint/Blueprint/help/Publish-AzBlueprint.md +++ b/src/Blueprint/Blueprint/help/Publish-AzBlueprint.md @@ -13,8 +13,8 @@ Publish a new version of a blueprint. ## SYNTAX ``` -Publish-AzBlueprint -Version -ChangeNote -Blueprint [-DefaultProfile ] - [] +Publish-AzBlueprint -Version [-ChangeNote ] -Blueprint + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -36,6 +36,7 @@ TargetScope : Subscription Parameters : {[tagName, Microsoft.Azure.Commands.Blueprint.Models.PSParameterValue], [tagValue, Microsoft.Azure.Commands.Blueprint.Models.PSParameterValue]} ResourceGroups : {storageRG} ``` + Publish a new version of a blueprint definition. ## PARAMETERS @@ -44,7 +45,7 @@ Publish a new version of a blueprint definition. Blueprint object. ```yaml -Type: PSBlueprint +Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprint Parameter Sets: (All) Aliases: @@ -55,11 +56,26 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +### -ChangeNote +Notes to describe the contents of this blueprint version. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -73,11 +89,8 @@ Accept wildcard characters: False ### -Version Version for the blueprint definition. -### -ChangeNote -Notes to describe the contents of this blueprint version. - ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -88,9 +101,38 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/Remove-AzBlueprintAssignment.md b/src/Blueprint/Blueprint/help/Remove-AzBlueprintAssignment.md index 83514491d6d8..066ccf0bf3bc 100644 --- a/src/Blueprint/Blueprint/help/Remove-AzBlueprintAssignment.md +++ b/src/Blueprint/Blueprint/help/Remove-AzBlueprintAssignment.md @@ -8,19 +8,25 @@ schema: 2.0.0 # Remove-AzBlueprintAssignment ## SYNOPSIS -Remove a blueprint assignment from a subscription. +Remove a blueprint assignment from a subscription or a management group. ## SYNTAX -### DeleteBlueprintAssignmentByName (Default) +### BySubscriptionAndName (Default) ``` -Remove-AzBlueprintAssignment [[-SubscriptionId] ] [-Name] [-PassThru] +Remove-AzBlueprintAssignment [-Name] [[-SubscriptionId] ] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ByManagementGroupAndName +``` +Remove-AzBlueprintAssignment [-Name] [-ManagementGroupId] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### DeleteBlueprintAssignmentByObject ``` -Remove-AzBlueprintAssignment [[-SubscriptionId] ] [-InputObject] [-PassThru] +Remove-AzBlueprintAssignment -InputObject [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -62,7 +68,22 @@ Parameter Sets: DeleteBlueprintAssignmentByObject Aliases: Required: True -Position: 1 +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ManagementGroupId +The ID of the management group where the Blueprint assignment is saved. + +```yaml +Type: System.String +Parameter Sets: ByManagementGroupAndName +Aliases: + +Required: True +Position: 0 Default value: None Accept pipeline input: True (ByValue) Accept wildcard characters: False @@ -73,7 +94,7 @@ Blueprint assignment name. ```yaml Type: System.String -Parameter Sets: DeleteBlueprintAssignmentByName +Parameter Sets: BySubscriptionAndName, ByManagementGroupAndName Aliases: Required: True @@ -84,7 +105,7 @@ Accept wildcard characters: False ``` ### -PassThru -{{Fill PassThru Description}} +When set, the cmdlet will return an object representing the removed Blueprint assignment. By default, this cmdlet does not generate any output. ```yaml Type: System.Management.Automation.SwitchParameter @@ -103,25 +124,13 @@ Subscription Id the blueprint assignment is deployed to. ```yaml Type: System.String -Parameter Sets: DeleteBlueprintAssignmentByName -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - -```yaml -Type: System.String -Parameter Sets: DeleteBlueprintAssignmentByObject +Parameter Sets: BySubscriptionAndName Aliases: Required: False Position: 0 Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` @@ -157,7 +166,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/Set-AzBlueprint.md b/src/Blueprint/Blueprint/help/Set-AzBlueprint.md index f3f5edbf655a..fcc2dde2f6f8 100644 --- a/src/Blueprint/Blueprint/help/Set-AzBlueprint.md +++ b/src/Blueprint/Blueprint/help/Set-AzBlueprint.md @@ -52,8 +52,8 @@ Update a blueprint definition with new parameters. Path to a Blueprint JSON file on disk. ```yaml -Type: String -Parameter Sets: CreateBlueprintBySubscription, CreateBlueprintByManagementGroup +Type: System.String +Parameter Sets: (All) Aliases: Required: True @@ -67,7 +67,7 @@ Accept wildcard characters: False The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -82,8 +82,8 @@ Accept wildcard characters: False Management Group Id where the blueprint definition is or will be saved. ```yaml -Type: String -Parameter Sets: CreateBlueprintByManagementGroup, ManagementGroupScope, ByManagementGroupAndName, ByManagementGroupNameAndVersion, ByManagementGroupNameAndLatestPublished +Type: System.String +Parameter Sets: UpdateBlueprintByManagementGroup Aliases: Required: True @@ -93,24 +93,12 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -```yaml -Type: String -Parameter Sets: ImportBlueprint -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -Name Blueprint definition name. ```yaml -Type: String -Parameter Sets: CreateBlueprintBySubscription, CreateBlueprintByManagementGroup, ImportBlueprint +Type: System.String +Parameter Sets: (All) Aliases: Required: True @@ -124,8 +112,8 @@ Accept wildcard characters: False Subscription Id where the blueprint definition is or will be saved. ```yaml -Type: String -Parameter Sets: CreateBlueprintBySubscription, ImportBlueprint, SubscriptionScope, BySubscriptionAndName, BySubscriptionNameAndVersion, BySubscriptionNameAndLatestPublished +Type: System.String +Parameter Sets: UpdateBlueprintBySubscription Aliases: Required: False @@ -139,7 +127,7 @@ Accept wildcard characters: False Prompts you for confirmation before running the cmdlet. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: cf @@ -155,7 +143,7 @@ Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: wi @@ -167,8 +155,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/Set-AzBlueprintArtifact.md b/src/Blueprint/Blueprint/help/Set-AzBlueprintArtifact.md index 2a0b8e88e109..ed47e88a4ec5 100644 --- a/src/Blueprint/Blueprint/help/Set-AzBlueprintArtifact.md +++ b/src/Blueprint/Blueprint/help/Set-AzBlueprintArtifact.md @@ -12,19 +12,18 @@ Update an artifact in a blueprint definition. ## SYNTAX - ### UpdateTemplateArtifact (Default) ``` Set-AzBlueprintArtifact -Name -Type -Blueprint [-Description ] [-DependsOn ] -TemplateParameterFile -TemplateFile [-ResourceGroupName ] - [-DefaultProfile ] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### UpdateArtifactByInputFile ``` Set-AzBlueprintArtifact -Name -Blueprint -ArtifactFile - [-DefaultProfile ] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### UpdateRoleAssignmentArtifact @@ -32,7 +31,7 @@ Set-AzBlueprintArtifact -Name -Blueprint -ArtifactFil Set-AzBlueprintArtifact -Name -Type -Blueprint [-Description ] [-DependsOn ] -RoleDefinitionId -RoleDefinitionPrincipalId [-ResourceGroupName ] - [-DefaultProfile ] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### UpdatePolicyAssignmentArtifact @@ -40,7 +39,7 @@ Set-AzBlueprintArtifact -Name -Type -Blueprint -Type -Blueprint [-Description ] [-DependsOn ] -PolicyDefinitionId -PolicyDefinitionParameter [-ResourceGroupName ] - [-DefaultProfile ] [] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -83,12 +82,10 @@ Id : /subscriptions/28cbf98f-381d-4425-9ac4-cf342dab9753/provide artifacts/ApplyTag-RG Type : Microsoft.Blueprint/blueprints/artifacts Name : ApplyTag-RG - ``` Update an artifact through inline parameters. - ### Example 3 ```powershell PS C:\> $bp = Get-AzBlueprint -Name SimpleBlueprint @@ -103,7 +100,6 @@ ResourceGroup : storageRG Id : /subscriptions/{subscriptionId}/providers/Microsoft.Blueprint/blueprints/AppNetwork/artifacts/storage-account Type : Microsoft.Blueprint/blueprints/artifacts Name : storage-account - ``` Update an artifact through an ARM template file. @@ -114,8 +110,8 @@ Update an artifact through an ARM template file. Location of the artifact file in JSON format on disk. ```yaml -Type: String -Parameter Sets: CreateArtifactByInputFile +Type: System.String +Parameter Sets: UpdateArtifactByInputFile Aliases: Required: True @@ -129,8 +125,8 @@ Accept wildcard characters: False Blueprint object. ```yaml -Type: PSBlueprintBase -Parameter Sets: UpdateTemplateArtifact, ArtifactsByBlueprint, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase +Parameter Sets: UpdateTemplateArtifact, UpdateRoleAssignmentArtifact, UpdatePolicyAssignmentArtifact Aliases: Required: True @@ -141,8 +137,8 @@ Accept wildcard characters: False ``` ```yaml -Type: PSBlueprintBase -Parameter Sets: CreateArtifactByInputFile +Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase +Parameter Sets: UpdateArtifactByInputFile Aliases: Required: True @@ -156,7 +152,7 @@ Accept wildcard characters: False The credentials, account, tenant, and subscription used for communication with Azure. ```yaml -Type: IAzureContextContainer +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer Parameter Sets: (All) Aliases: AzContext, AzureRmContext, AzureCredential @@ -172,7 +168,7 @@ List of the names of artifacts that needs to be created before current artifact ```yaml Type: System.Collections.Generic.List`1[System.String] -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Parameter Sets: UpdateTemplateArtifact, UpdateRoleAssignmentArtifact, UpdatePolicyAssignmentArtifact Aliases: Required: False @@ -186,8 +182,8 @@ Accept wildcard characters: False Description of the artifact. ```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: System.String +Parameter Sets: UpdateTemplateArtifact, UpdateRoleAssignmentArtifact, UpdatePolicyAssignmentArtifact Aliases: Required: False @@ -201,8 +197,8 @@ Accept wildcard characters: False Name of the artifact ```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact, CreateArtifactByInputFile, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: System.String +Parameter Sets: (All) Aliases: Required: True @@ -212,24 +208,12 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -```yaml -Type: String -Parameter Sets: ArtifactsByBlueprint -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -PolicyDefinitionId Definition Id of the policy definition. ```yaml -Type: String -Parameter Sets: CreatePolicyArtifact +Type: System.String +Parameter Sets: UpdatePolicyAssignmentArtifact Aliases: Required: True @@ -243,8 +227,8 @@ Accept wildcard characters: False Hashtable of parameters to pass to the policy definition artifact. ```yaml -Type: Hashtable -Parameter Sets: CreatePolicyArtifact +Type: System.Collections.Hashtable +Parameter Sets: UpdatePolicyAssignmentArtifact Aliases: Required: True @@ -258,8 +242,8 @@ Accept wildcard characters: False Name of the resource group the artifact is going to be under. ```yaml -Type: String -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: System.String +Parameter Sets: UpdateTemplateArtifact, UpdateRoleAssignmentArtifact, UpdatePolicyAssignmentArtifact Aliases: Required: False @@ -273,8 +257,8 @@ Accept wildcard characters: False List of role definition ```yaml -Type: String -Parameter Sets: CreateRoleAssignmentArtifact +Type: System.String +Parameter Sets: UpdateRoleAssignmentArtifact Aliases: Required: True @@ -288,8 +272,8 @@ Accept wildcard characters: False List of role definition principal ids. ```yaml -Type: String[] -Parameter Sets: CreateRoleAssignmentArtifact +Type: System.String[] +Parameter Sets: UpdateRoleAssignmentArtifact Aliases: Required: True @@ -303,7 +287,7 @@ Accept wildcard characters: False Location of the ARM template file on disk. ```yaml -Type: String +Type: System.String Parameter Sets: UpdateTemplateArtifact Aliases: @@ -318,7 +302,7 @@ Accept wildcard characters: False Location of the ARM template parameter file on disk. ```yaml -Type: String +Type: System.String Parameter Sets: UpdateTemplateArtifact Aliases: @@ -334,8 +318,8 @@ Type of the artifact. There are 3 types supported: RoleAssignmentArtifact, PolicyAssignmentArtifact, TemplateArtifact. ```yaml -Type: PSArtifactKind -Parameter Sets: UpdateTemplateArtifact, CreateRoleAssignmentArtifact, CreatePolicyArtifact +Type: Microsoft.Azure.Commands.Blueprint.Models.PSArtifactKind +Parameter Sets: UpdateTemplateArtifact, UpdateRoleAssignmentArtifact, UpdatePolicyAssignmentArtifact Aliases: Accepted values: RoleAssignmentArtifact, PolicyAssignmentArtifact, TemplateArtifact @@ -346,9 +330,38 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/src/Blueprint/Blueprint/help/Set-AzBlueprintAssignment.md b/src/Blueprint/Blueprint/help/Set-AzBlueprintAssignment.md index cae28e604180..c697512f233e 100644 --- a/src/Blueprint/Blueprint/help/Set-AzBlueprintAssignment.md +++ b/src/Blueprint/Blueprint/help/Set-AzBlueprintAssignment.md @@ -17,15 +17,15 @@ Update an existing blueprint assignment. Set-AzBlueprintAssignment -Name -Blueprint -Location [-SystemAssignedIdentity] [-UserAssignedIdentity ] [-Lock ] [-SecureStringParameter ] [-ResourceGroupParameter ] [-Parameter ] - [-SubscriptionId ] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] + [-ManagementGroupId ] [-SubscriptionId ] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ### UpdateBlueprintAssignmentByFile ``` -Set-AzBlueprintAssignment -Name -Blueprint [-AssignmentFile ] - [-SubscriptionId ] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] +Set-AzBlueprintAssignment -Name [-Blueprint ] [-AssignmentFile ] + [-ManagementGroupId ] [-SubscriptionId ] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -69,14 +69,37 @@ ResourceGroups : ResourceGroup Update an existing blueprint assignment through an assignment file. The format of the assignment file can be found in the request/response samples at: https://github.com/Azure/azure-rest-api-specs/tree/master/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples +### Example 3 +```powershell +PS C:\> $blueprintObject = Get-AzBlueprint -ManagementGroup "myManagementGroup" -Name "myBlueprintName" +PS C:\> Set-AzBlueprintAssignment -Name "myAssignment" -Blueprint $blueprintObject -ManagementGroupId "myManagementGroup" -SubscriptionId 00000000-1111-0000-1111-000000000000 -Location "West US" -Parameter @{P1="v1"; P2="v2"} +``` + +Update an existing blueprint assignment of the blueprint definition `$blueprintObject` targeting the specified subscription within the specified management group using the defined parameter. + ## PARAMETERS +### -AssignmentFile +Location of the assignment file in JSON format on disk. + +```yaml +Type: System.String +Parameter Sets: UpdateBlueprintAssignmentByFile +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Blueprint Blueprint object. ```yaml Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment Aliases: Required: True @@ -86,6 +109,18 @@ Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` +```yaml +Type: Microsoft.Azure.Commands.Blueprint.Models.PSBlueprintBase +Parameter Sets: UpdateBlueprintAssignmentByFile +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure. @@ -107,7 +142,7 @@ Learn more at aka.ms/blueprintmsi ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment Aliases: Required: True @@ -123,7 +158,7 @@ Learn more at aka.ms/blueprintlocks ```yaml Type: System.Nullable`1[Microsoft.Azure.Commands.Blueprint.Models.PSLockMode] -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment Aliases: Accepted values: None, AllResourcesReadOnly, AllResourcesDoNotDelete @@ -134,12 +169,51 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ManagementGroupId +The ID of the management group where the Blueprint assignment(s) will be saved. + +```yaml +Type: System.String +Parameter Sets: UpdateBlueprintAssignment +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +```yaml +Type: System.String +Parameter Sets: UpdateBlueprintAssignmentByFile +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -Name Blueprint assignment name. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +```yaml +Type: System.String +Parameter Sets: UpdateBlueprintAssignmentByFile Aliases: Required: True @@ -154,7 +228,7 @@ Artifact parameter. ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment Aliases: Required: False @@ -165,11 +239,11 @@ Accept wildcard characters: False ``` ### -ResourceGroupParameter -{{Fill ResourceGroupParameter Description}} +Hashtable of parameters to pass to the resource group artifact. ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment Aliases: Required: False @@ -184,7 +258,7 @@ Secure string parameter for KeyVault resource id, name and version. ```yaml Type: System.Collections.Hashtable -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment Aliases: Required: False @@ -200,7 +274,19 @@ Can be a comma delimited list of subscriptionId strings. ```yaml Type: System.String[] -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +```yaml +Type: System.String[] +Parameter Sets: UpdateBlueprintAssignmentByFile Aliases: Required: False @@ -215,7 +301,7 @@ System assigned identity(MSI) to deploy the artifacts. ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment Aliases: Required: False @@ -230,13 +316,13 @@ User assigned identity(MSI) to deploy the artifacts. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: UpdateBlueprintAssignment Aliases: Required: False Position: Named Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: False Accept wildcard characters: False ``` @@ -272,7 +358,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS