@@ -977,10 +977,6 @@ Removes the activation resource created during New-AzsActivationResource
977977Prompts the user to log in to the Azure Stack Administrator account, finds and removes the activation resource created
978978during New-AzsActivationResource. This will remove any downloaded marketplace products.
979979
980- . PARAMETER AzureStackAdminSubscriptionId
981-
982- The subscription id of the Azure Stack administrator. This user must have access to the 'marketplace management' blade.
983-
984980#>
985981Function Remove-AzsActivationResource {
986982[CmdletBinding ()]
@@ -991,9 +987,6 @@ Function Remove-AzsActivationResource{
991987 [Parameter (Mandatory = $true )]
992988 [String ] $PrivilegedEndpoint ,
993989
994- [Parameter (Mandatory = $false )]
995- [String ] $AzureStackAdminSubscriptionId ,
996-
997990 [Parameter (Mandatory = $false )]
998991 [String ] $AzureEnvironmentName = " AzureStack"
999992 )
@@ -1008,27 +1001,8 @@ Function Remove-AzsActivationResource{
10081001 try
10091002 {
10101003 $session = Initialize-PrivilegedEndpointSession - PrivilegedEndpoint $PrivilegedEndpoint - PrivilegedEndpointCredential $PrivilegedEndpointCredential - Verbose
1011-
1012- $AzureStackStampInfo = Invoke-Command - Session $session - ScriptBlock { Get-AzureStackStampInformation }
1013- Log- Output " Logging in to AzureStack administrator account. TenantId: $ ( $AzureStackStampInfo.AADTenantID ) Environment: 'AzureStack'"
1014- Login- AzureRmAccount - TenantId $AzureStackStampInfo.AADTenantID - Environment $AzureEnvironmentName
1015- $azureStackContext = Get-AzureRmContext
1016-
1017- $azureStackContextDetails = @ {
1018- Account = $azureStackContext.Account
1019- Environment = $azureStackContext.Environment
1020- Subscription = $azureStackContext.Subscription
1021- Tenant = $azureStackContext.Tenant
1022- }
1023-
1024- Log- Output " Successfully logged into Azure Stack account: $ ( ConvertTo-Json $azureStackContextDetails ) "
1025- if (-not $AzureStackAdminSubscriptionId )
1026- {
1027- $AzureStackAdminSubscriptionId = $azureStackContext.Subscription.Id
1028- }
1029- $activationResource = Get-AzureRmResource - ResourceId " /subscriptions/$AzureStackAdminSubscriptionId /resourceGroups/azurestack-activation/providers/Microsoft.AzureBridge.Admin/activations/default"
1030- Log- Output " Activation resource found: $ ( ConvertTo-Json $activationResource ) "
1031- Remove-AzureRmResource - ResourceId $activationResource.ResourceId - Force
1004+ Log- Output " Successfully initialized session with endpoint: $PrivilegedEndpoint "
1005+ $activation = Invoke-Command - Session $session - ScriptBlock { Remove-AzureStackActivation }
10321006 }
10331007 catch
10341008 {
0 commit comments