-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGet-APIs.ps1
55 lines (45 loc) · 1.99 KB
/
Get-APIs.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
connect-azaccount
get-azsubscription
set-azcontext -subscription 8a0ecebc-0e1d-4e8f-8cb8-8a92f49455b9
connect-azaccount -Environment AzureUSGovernment
Class AzAPIs{
[string]$ResourceTypeName
[string]$cloud
[string]$latestAPI
[array] $availableAPIs
[array] $locations
}
$hostPool = (Get-AzResourceProvider -ProviderNamespace Microsoft.DesktopVirtualization).ResourceTypes
$arrResources = @()
Foreach($item in $hostPool){
$AzureGlobalobj = New-Object AzAPIs
write-host "ResourceTypeName:" $Item.ResourceTypeName
$AzureGlobalobj.ResourceTypeName = $item.ResourceTypeName
$latestAPI = ($item.ApiVersions | Sort-Object)[-1]
write-host "ApiVersions:" $latestAPI
$AzureGlobalobj.latestAPI = $latestAPI
$AzureGlobalobj.availableAPIs = $item.ApiVersions
$AzureGlobalobj.locations = $item.Locations
$AzureGlobalobj.cloud = "AzureCloud"
Write-Host "Writing to object: " $AzureGlobalobj
$arrResources += $AzureGlobalobj
}
connect-azaccount -Environment AzureUSGovernment
$arrGovResources = @()
Foreach($item in $hostPool){
$AzureGlobalobj = New-Object AzAPIs
write-host "ResourceTypeName:" $Item.ResourceTypeName
$AzureGlobalobj.ResourceTypeName = $item.ResourceTypeName
$latestAPI = ($item.ApiVersions | Sort-Object)[-1]
write-host "ApiVersions:" $latestAPI
$AzureGlobalobj.latestAPI = $latestAPI
$AzureGlobalobj.availableAPIs = $item.ApiVersions
$AzureGlobalobj.locations = $item.Locations
$AzureGlobalobj.cloud = "AzureUSGovernment"
Write-Host "Writing to object: " $AzureGlobalobj
$arrGovResources += $AzureGlobalobj
}
$a = $arrResources[0].availableAPIs + $arrGovResources[0].availableAPIs
Compare-Object -DifferenceObject $arrResources[0].availableAPIs -ReferenceObject $arrGovResources[0].availableAPIs -ExcludeDifferent
$b = $a | Select-Object availableAPIs -Unique
Compare-Object -Property availableAPIs -ReferenceObject $a -DifferenceObject $b -PassThru | Select-Object * -ExcludeProperty SideIndicator