@@ -39,32 +39,32 @@ Function Select-MonkeyAzureSubscription{
3939 $AllSubscriptions = @ ()
4040 # Create selected subscriptions and sub vars
4141 $selected_subscriptions = $sub = $null
42- if ($null -ne $O365Object.auth_tokens.ResourceManager ){
42+ If ($null -ne $O365Object.auth_tokens.ResourceManager ){
4343 $sparam = @ {
4444 AuthObject = $O365Object.auth_tokens.ResourceManager
4545 Endpoint = $O365Object.Environment.ResourceManager
4646 }
4747 $sub = Get-MonkeySubscriptionInfo @sparam
4848 }
49- if ($null -ne $sub ){
50- if ($null -ne $O365Object.Tenant -and $O365Object.Tenant.psobject.Properties.Item (' TenantName' )){
49+ If ($null -ne $sub ){
50+ If ($null -ne $O365Object.Tenant -and $O365Object.Tenant.psobject.Properties.Item (' TenantName' )){
5151 Write-Information - MessageData (" Subscription was found on {0} Tenant" -f $O365Object.Tenant.TenantName ) - InformationAction $InformationAction
5252 }
53- elseif ($O365Object.psobject.Properties.Item (' TenantId' )){
53+ ElseIf ($O365Object.psobject.Properties.Item (' TenantId' )){
5454 Write-Information - MessageData (" subscription was found on {0} Tenant" -f $O365Object.tenantId ) - InformationAction $InformationAction
5555 }
56- else {
56+ Else {
5757 Write-Information - MessageData (" Subscription {0} was found" -f $sub.DisplayName ) - InformationAction $InformationAction
5858 }
5959 $sub | Add-Member - type NoteProperty - name TenantID - value $O365Object.TenantId - Force
60- if ($null -ne $O365Object.Tenant ){
61- if ($null -ne $O365Object.Tenant.Psobject.Properties.Item (' TenantName' )){
60+ If ($null -ne $O365Object.Tenant ){
61+ If ($null -ne $O365Object.Tenant.Psobject.Properties.Item (' TenantName' )){
6262 $sub | Add-Member - type NoteProperty - name TenantName - value $O365Object.Tenant.TenantName - Force
6363 }
64- elseif ($null -ne $O365Object.Tenant.Psobject.Properties.Item (' displayName' )){
64+ ElseIf ($null -ne $O365Object.Tenant.Psobject.Properties.Item (' displayName' )){
6565 $sub | Add-Member - type NoteProperty - name TenantName - value $O365Object.Tenant.displayName - Force
6666 }
67- else {
67+ Else {
6868 $msg = @ {
6969 MessageData = ($message.EntraIDTenantNameError );
7070 callStack = (Get-PSCallStack | Select-Object - First 1 );
@@ -79,7 +79,7 @@ Function Select-MonkeyAzureSubscription{
7979 }
8080 $AllSubscriptions += $sub
8181 }
82- else {
82+ Else {
8383 $msg = @ {
8484 MessageData = ($message.AzureSubscriptionNotFound -f $O365Object.TenantId );
8585 callStack = (Get-PSCallStack | Select-Object - First 1 );
@@ -91,32 +91,32 @@ Function Select-MonkeyAzureSubscription{
9191 }
9292 }
9393 Process {
94- if ($AllSubscriptions.Count -gt 0 ){
95- if ($AllSubscriptions.Count -eq 1 ){
94+ If ($AllSubscriptions.Count -gt 0 ){
95+ If ($AllSubscriptions.Count -eq 1 ){
9696 $selected_subscriptions = $AllSubscriptions
9797 }
98- elseif ($O365Object.initParams.ContainsKey (' AllSubscriptions' ) -and $O365Object.initParams.AllSubscriptions -eq $true ){
98+ ElseIf ($O365Object.initParams.ContainsKey (' AllSubscriptions' ) -and $O365Object.initParams.AllSubscriptions -eq $true ){
9999 $selected_subscriptions = $AllSubscriptions
100100 }
101- elseif ($O365Object.initParams.ContainsKey (' Subscriptions' )){
101+ ElseIf ($O365Object.initParams.ContainsKey (' Subscriptions' )){
102102 $selected_subscriptions = @ ()
103103 foreach ($subscriptionId in $O365Object.initParams.Subscriptions.Split (' ' )){
104104 $sub = $AllSubscriptions | Where-Object {$_.subscriptionId -eq $subscriptionId } | Select-Object * - ErrorAction Ignore
105- if ($sub ){$selected_subscriptions += $sub }
105+ If ($sub ){$selected_subscriptions += $sub }
106106 }
107107 }
108- else {
109- if ($PSEdition -eq " Desktop" ){
108+ Else {
109+ If ($PSEdition -eq " Desktop" ){
110110 $selected_subscriptions = $AllSubscriptions | Out-GridView - Title " Choose a Source Subscription ..." - PassThru
111111 }
112- else {
112+ Else {
113113 $selected_subscriptions = Select-MonkeySubscriptionConsole - Subscriptions $AllSubscriptions
114114 }
115115 }
116116 }
117117 }
118118 End {
119- if ($null -ne $selected_subscriptions ){
119+ If ($null -ne $selected_subscriptions ){
120120 return $selected_subscriptions
121121 }
122122 }
0 commit comments