Skip to content

Commit 47b529b

Browse files
Merge pull request #276 from Azure/rbao/infracmdlet
Add Set-AzSLocationInformation
2 parents 623c62c + 37f7d31 commit 47b529b

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Infrastructure/AzureStack.Infra.psm1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,46 @@ function Get-AzsBackup {
606606

607607
Export-ModuleMember -Function Get-AzsBackup
608608

609+
<#
610+
.SYNOPSIS
611+
Set Azure Stack geographic location information
612+
#>
613+
614+
function Set-AzSLocationInformation {
615+
param(
616+
[Parameter(Mandatory = $false)]
617+
[string] $Location,
618+
619+
[Parameter(Mandatory = $true)]
620+
[string] $Latitude = '47.608013',
621+
622+
[Parameter(Mandatory = $true)]
623+
[string] $Longitude = '-122.335167'
624+
)
625+
626+
$Location = Get-AzsHomeLocation -Location $Location
627+
628+
$resourceType = "Microsoft.Subscriptions.Admin/locations"
629+
$apiVersion = "2015-11-01"
630+
631+
$locationResource = Get-AzureRmResource -ResourceType $resourceType -ResourceName $Location -ApiVersion $apiVersion
632+
633+
$params = @{
634+
ResourceName = $Location
635+
ResourceType = $resourceType
636+
ApiVersion = $apiVersion
637+
Properties = @{
638+
Id = $locationResource.ResourceId
639+
Name = $locationResource.Name
640+
DisplayName = $locationResource.Name
641+
Latitude = $Latitude
642+
Longitude = $Longitude
643+
}
644+
}
645+
646+
New-AzureRmResource @params -IsFullObject -Force
647+
}
648+
609649
function Get-AzsHomeLocation {
610650
param(
611651
[Parameter(Mandatory = $false)]

0 commit comments

Comments
 (0)