Skip to content

Commit db98952

Browse files
committed
2 parents 10f395b + 82cfc0f commit db98952

File tree

5 files changed

+96
-43
lines changed

5 files changed

+96
-43
lines changed

Infrastructure/AzureStack.Infra.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Export-ModuleMember -Function Get-AzsInfrastructureRoleInstance
118118
.SYNOPSIS
119119
List File Shares
120120
#>
121-
function Get-AzsStorageShare {
121+
function Get-AzsInfrastructureShare {
122122
Param(
123123
[Parameter(Mandatory = $false)]
124124
[string] $Location
@@ -130,7 +130,7 @@ function Get-AzsStorageShare {
130130
$shares
131131
}
132132

133-
Export-ModuleMember -Function Get-AzsStorageShare
133+
Export-ModuleMember -Function Get-AzsInfrastructureShare
134134

135135
<#
136136
.SYNOPSIS

Infrastructure/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Add-AzureRMEnvironment -Name "AzureStackAdmin" -ArmEndpoint "https://adminmanage
2222
Then login:
2323

2424
```powershell
25-
Login-AzureRmAccount -EnvironmentName "AzureStackAdmin"
25+
Login-AzureRmAccount -EnvironmentName "AzureStackAdmin"
2626
```
2727
----
2828
If you are **not** using your home directory tenant, you will need to supply the tenant ID to your login command. You may find it easiest to obtain using the Connect tool. For **Azure Active Directory** environments provide your directory tenant name:
@@ -179,7 +179,7 @@ The command does the following:
179179

180180
```powershell
181181
182-
Get-AzsStorageShare
182+
Get-AzsInfrastructureShare
183183
```
184184

185185
The command does the following:

Infrastructure/Tests/Infra.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ InModuleScope $script:ModuleName {
5656
{ Get-AzsInfraRoleInstance } |
5757
Should Not Throw
5858
}
59-
It 'Get-AzsStorageShare should not throw' {
60-
{ Get-AzsStorageShare } |
59+
It 'Get-AzsInfrastructureShare should not throw' {
60+
{ Get-AzsInfrastructureShare } |
6161
Should Not Throw
6262
}
6363
It 'Get-Azslogicalnetwork should not throw' {

ServiceAdmin/AzureStack.ServiceAdmin.psm1

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,13 @@
88
Creates "default" tenant offer with unlimited quotas across Compute, Network, Storage and KeyVault services.
99
#>
1010

11-
function Add-AzsStorageQuota {
11+
function New-AzsComputeQuota {
1212
param(
1313
[string] $Name = "default",
14-
[int] $CapacityInGb = 1000,
15-
[int] $NumberOfStorageAccounts = 2000,
16-
[string] $Location = $null
17-
)
18-
19-
$Location = Get-AzsHomeLocation -Location $Location
20-
21-
$params = @{
22-
ResourceName = "{0}/{1}" -f $Location, $Name
23-
ResourceType = "Microsoft.Storage.Admin/locations/quotas"
24-
ApiVersion = "2015-12-01-preview"
25-
Properties = @{
26-
capacityInGb = $CapacityInGb
27-
numberOfStorageAccounts = $NumberOfStorageAccounts
28-
}
29-
}
30-
31-
New-AzsServiceQuota @params
32-
}
33-
34-
function Add-AzsComputeQuota {
35-
param(
36-
[string] $Name = "default",
37-
[int] $VmCount = 1000,
38-
[int] $MemoryLimitMB = 1048576,
39-
[int] $CoresLimit = 1000,
14+
[int] $CoresLimit = 200,
15+
[int] $VirtualMachineCount = 50,
16+
[int] $AvailabilitySetCount = 10,
17+
[int] $VmScaleSetCount = 10,
4018
[string] $Location = $null
4119
)
4220

@@ -47,16 +25,17 @@ function Add-AzsComputeQuota {
4725
ResourceType = "Microsoft.Compute.Admin/locations/quotas"
4826
ApiVersion = "2015-12-01-preview"
4927
Properties = @{
50-
virtualMachineCount = $VmCount
51-
memoryLimitMB = $MemoryLimitMB
52-
coresLimit = $CoresLimit
28+
virtualMachineCount = $VirtualMachineCount
29+
availabilitySetCount = $AvailabilitySetCount
30+
coresLimit = $CoresLimit
31+
vmScaleSetCount = $VmScaleSetCount
5332
}
5433
}
5534

5635
New-AzsServiceQuota @params
5736
}
5837

59-
function Add-AzsNetworkQuota {
38+
function New-AzsNetworkQuota {
6039
param(
6140
[string] $Name = "default",
6241
[int] $PublicIpsPerSubscription = 500,
@@ -145,7 +124,15 @@ function New-AzsServiceQuota {
145124
)
146125

147126
$serviceQuota = New-AzureRmResource -ResourceName $ResourceName -ResourceType $ResourceType -ApiVersion $ApiVersion -Properties $Properties -Force
148-
$serviceQuota.ResourceId
127+
$quotaObject = New-Object PSObject
128+
foreach ($property in ($serviceQuota.Properties | Get-Member -MemberType NoteProperty)){
129+
$quotaObject | Add-Member NoteProperty -Name $property.Name -Value $serviceQuota.Properties.($property.Name)
130+
}
131+
$quotaObject | Add-Member NoteProperty Name($serviceQuota.ResourceName)
132+
$quotaObject | Add-Member NoteProperty Type($serviceQuota.ResourceType)
133+
$quotaObject | Add-Member NoteProperty Location($serviceQuota.Location)
134+
$quotaObject | Add-Member NoteProperty Id($serviceQuota.ResourceId)
135+
$quotaObject
149136
}
150137

151138
function Get-AzsServiceQuota {

ServiceAdmin/README.md

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Make sure you have the following module prerequisites installed:
77
```powershell
88
Install-Module -Name 'AzureRm.Bootstrapper' -Scope CurrentUser
99
Install-AzureRmProfile -profile '2017-03-09-profile' -Force -Scope CurrentUser
10-
Install-Module -Name AzureStack -RequiredVersion 1.2.9 -Scope CurrentUser
10+
Install-Module -Name AzureStack -RequiredVersion 1.2.10 -Scope CurrentUser
1111
```
1212

1313
Then make sure the following modules are imported:
@@ -17,17 +17,83 @@ Import-Module ..\Connect\AzureStack.Connect.psm1
1717
Import-Module .\AzureStack.ServiceAdmin.psm1
1818
```
1919

20-
You will need to reference your Azure Stack Administrator environment. To create an administrator environment use the below. The ARM endpoint below is the administrator default for a one-node environment.
20+
## Add PowerShell environment
21+
22+
You will need to login to your Azure Stack Administrator environment. To create an administrator environment use the below. The ARM endpoint below is the administrator default for a one-node environment.
23+
24+
```powershell
25+
Add-AzureRMEnvironment -Name "AzureStackAdmin" -ArmEndpoint "https://adminmanagement.local.azurestack.external"
26+
```
27+
28+
Then login:
29+
30+
```powershell
31+
Login-AzureRmAccount -EnvironmentName "AzureStackAdmin"
32+
```
33+
----
34+
If you are **not** using your home directory tenant, you will need to supply the tenant ID to your login command. You may find it easiest to obtain using the Connect tool. For **Azure Active Directory** environments provide your directory tenant name:
35+
36+
```powershell
37+
$TenantID = Get-AzsDirectoryTenantId -AADTenantName "<mydirectorytenant>.onmicrosoft.com" -EnvironmentName AzureStackAdmin
38+
```
39+
40+
For **ADFS** environments use the following:
2141

2242
```powershell
23-
Add-AzsEnvironment -Name "AzureStackAdmin" -ArmEndpoint "https://adminmanagement.local.azurestack.external"
43+
$TenantID = Get-AzsDirectoryTenantId -ADFS -EnvironmentName AzureStackAdmin
2444
```
2545

2646

2747
## Create default plan and quota for tenants
2848

2949
```powershell
30-
Add-AzsTenantOfferAndQuota
50+
# Default quotas, plan, and offer
51+
$PlanName = "SimplePlan"
52+
$OfferName = "SimpleOffer"
53+
$RGName = "PlansandoffersRG"
54+
$Location = (Get-AzsLocation).Name
55+
56+
$computeParams = @{
57+
Name = "computedefault"
58+
CoresLimit = 200
59+
AvailabilitySetCount = 10
60+
VirtualMachineCount = 50
61+
VmScaleSetCount = 10
62+
Location = $Location
63+
}
64+
65+
$netParams = @{
66+
Name = "netdefault"
67+
PublicIpsPerSubscription = 500
68+
VNetsPerSubscription = 500
69+
GatewaysPerSubscription = 10
70+
ConnectionsPerSubscription = 20
71+
LoadBalancersPerSubscription = 500
72+
NicsPerSubscription = 1000
73+
SecurityGroupsPerSubscription = 500
74+
Location = $Location
75+
}
76+
77+
$storageParams = @{
78+
Name = "storagedefault"
79+
NumberOfStorageAccounts = 20
80+
CapacityInGB = 2048
81+
Location = $Location
82+
}
83+
84+
$kvParams = @{
85+
Location = $Location
86+
}
87+
88+
$quotaIDs = @()
89+
$quotaIDs += (New-AzsNetworkQuota @netParams).ID
90+
$quotaIDs += (New-AzsComputeQuota @computeParams).ID
91+
$quotaIDs += (New-AzsStorageQuota @storageParams).ID
92+
$quotaIDs += (Get-AzsKeyVaultQuota @kvParams)
93+
94+
New-AzureRmResourceGroup -Name $RGName -Location $Location
95+
$plan = New-AzsPlan -Name $PlanName -DisplayName $PlanName -ArmLocation $Location -ResourceGroupName $RGName -QuotaIds $QuotaIDs
96+
New-AzsOffer -Name $OfferName -DisplayName $OfferName -State Public -BasePlanIds $plan.Id -ResourceGroupName $RGName -ArmLocation $Location
3197
```
3298

33-
Tenants can now see the "default" offer available to them and can subscribe to it. The offer includes unlimited compute, network, storage and key vault usage.
99+
Tenants can now see the "SimpleOffer" offer available to them and can subscribe to it. The offer includes unlimited compute, network, storage and key vault usage.

0 commit comments

Comments
 (0)