Skip to content

Commit dfe0d9a

Browse files
authored
Merge branch 'master' into master
2 parents 19633f5 + 260a313 commit dfe0d9a

3 files changed

Lines changed: 57 additions & 3 deletions

File tree

Infrastructure/AzureStack.Infra.psm1

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,39 @@ $IPPoolBodyJson =$IPPoolBody |ConvertTo-Json
799799
}
800800
export-modulemember -function Add-AzSIPPool
801801

802+
Function Set-AzSLocationInformation {
803+
Param(
804+
[Parameter(Mandatory = $true)]
805+
[ValidateNotNullorEmpty()]
806+
[String] $TenantId,
807+
808+
[Parameter(Mandatory = $true)]
809+
[System.Management.Automation.PSCredential] $AzureStackCredentials,
810+
811+
[Parameter(Mandatory = $true)]
812+
[string] $EnvironmentName,
813+
814+
[Parameter(Mandatory = $true)]
815+
[string] $Region = 'local',
816+
817+
[Parameter(Mandatory = $true)]
818+
[string] $Latitude = '47.608013',
819+
820+
[Parameter(Mandatory = $true)]
821+
[string] $Longitude = '-122.335167'
822+
)
823+
$ArmEndpoint = GetARMEndpoint -EnvironmentName $EnvironmentName -ErrorAction Stop
824+
$subscription, $headers = (Get-AzureStackAdminSubTokenHeader -TenantId $TenantId -AzureStackCredentials $AzureStackCredentials -EnvironmentName $EnvironmentName)
825+
$uri = "{0}/subscriptions/{1}/providers/Microsoft.Subscriptions.Admin/locations/{2}?api-version=2015-11-01" -f $ArmEndpoint, $subscription, $Region
826+
827+
$obtainedRegion = Invoke-RestMethod -Method GET -Uri $uri -ContentType 'application/json' -Headers $headers
828+
$obtainedRegion.latitude = $Latitude
829+
$obtainedRegion.longitude = $Longitude
830+
831+
Invoke-WebRequest -Uri $uri -Method PUT -Body $(Convertto-Json $obtainedRegion) -ContentType 'application/json' -Headers $headers
832+
}
833+
Export-ModuleMember -function Set-AzSLocationInformation
834+
802835
Function GetARMEndpoint{
803836
param(
804837
# Azure Stack environment name
@@ -816,4 +849,4 @@ Function GetARMEndpoint{
816849
}
817850

818851
$ARMEndpoint
819-
}
852+
}

Infrastructure/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ Start-AzSInfraRoleInstance -AzureStackCredentials $credential -TenantID $TenantI
421421
Get-AzSAlert -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"|where {$_.state -eq "active"}
422422
```
423423

424+
424425
### Increase Public IP Pool Capacity
425426
```powershell
426427
#Retrieve all Alerts and apply a filter to only show active Alerts
@@ -453,4 +454,21 @@ Get-AzSUpdateRun -AzureStackCredentials $credential -TenantID $TenantID -Environ
453454
454455
#Review Region Update Summary after successful run
455456
Get-AzSUpdateSummary -AzureStackCredentials $credential -TenantID $TenantID -EnvironmentName "AzureStackAdmin"
457+
458+
459+
### Set Azure Stack's Latitude and Longitude
460+
461+
This command modifies an Azure Stack instance's latitude and longitude location
462+
463+
```powershell
464+
$EnvironmentName = "AzureStackAdmin"
465+
$directoryName = "<<yourDirectoryName>>.onmicrosoft.com"
466+
$credential = Get-Credential
467+
$latitude = '12.972442'
468+
$longitude = '77.580643'
469+
$regionName = 'local'
470+
471+
$TenantID = Get-DirectoryTenantID -AADTenantName $directoryName -EnvironmentName AzureStackAdmin
472+
Set-AzSLocationInformation -TenantID $AadTenant -EnvironmentName $EnvironmentName -AzureStackCredentials $credential -Region $regionName -Latitude $latitude -Longitude $longitude
473+
456474
```

Infrastructure/Tests/Infra.Tests.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ InModuleScope $script:ModuleName {
3737
$EnvironmentName = $global:EnvironmentName
3838

3939

40-
4140
Describe 'Infra - Functional Tests' {
4241
It 'Get-AzSAlert should not throw' {
4342
{ Get-AzSAlert -TenantID $AadTenant -EnvironmentName $EnvironmentName -AzureStackCredentials $stackLoginCreds } |
@@ -80,9 +79,13 @@ InModuleScope $script:ModuleName {
8079
{ Get-AzSUpdate -TenantID $AadTenant -EnvironmentName $EnvironmentName -AzureStackCredentials $stackLoginCreds } |
8180
Should Not Throw
8281
}
82+
It 'Set-AzSLocationInformation should not throw' {
83+
{ Set-AzSLocationInformation -TenantID $AadTenant -EnvironmentName $EnvironmentName -AzureStackCredentials $stackLoginCreds -Region 'local' -Latitude '12.972442' -Longitude '77.580643'} |
84+
Should Not Throw
85+
}
8386

8487

8588
}
8689

8790

88-
}
91+
}

0 commit comments

Comments
 (0)