Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Get Azure subscription login information and CSP tenant account
  2. Write-Host "Please enter the Domain Name of the Azure customer tenant you would like to access."
  3. Write-Host "Ex: NebulaCorp.onmicrosoft.com`n" -ForegroundColor Cyan
  4. $TenantFQDN = Read-Host  
  5.  
  6.  
  7. #Login to Azure using supplied credentials and define the Tenant ID as the default tenant to make changes to.
  8. Login-AzureRmAccount -Tenant $TenantFQDN
  9.  
  10. #Get TenantID and SubscriptionID
  11. $TenantID = (Get-AzureRmContext).Tenant.Id
  12. $SubscriptionId = (Get-AzureRmSubscription -TenantId $TenantID) | ?{$_.SubscriptionName -like "*Azure*" -and $_.State -eq "Enabled"} | Select-Object -ExpandProperty SubscriptionId
  13.  
  14. #Select Azure Subscription to make changes to
  15. Select-AzureRmSubscription -TenantId $TenantID -SubscriptionId $SubscriptionID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement