You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script can be used to register Azure Stack with Azure. To run this script, you must have a public Azure subscription of any type.
23
+
Add-AzsRegistration can be used to register Azure Stack with Azure. To run this function, you must have a public Azure subscription of any type.
24
24
You must also have access to an account that is an owner or contributor to that subscription.
25
25
26
26
.DESCRIPTION
27
27
28
-
RegisterWithAzure runs scripts already present in Azure Stack from the ERCS VM to connect your Azure Stack to Azure.
28
+
Add-AzsRegistration runs scripts already present in Azure Stack from the ERCS VM to connect your Azure Stack to Azure.
29
29
After connecting with Azure, you can download products from the marketplace (See the documentation for more information: https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-download-azure-marketplace-item).
30
30
Running this script with default parameters will enable marketplace syndication and usage data will default to being reported to Azure.
31
-
To turn these features off see examples below.
31
+
NOTE: Default billing model is 'Development' and is only usable for proof of concept builds.
32
+
To disable syndication or usage reporting see examples below.
32
33
33
34
This script will create the following resources by default:
34
35
- A service principal to perform resource actions
35
36
- A resource group in Azure (if needed)
36
37
- A registration resource in the created resource group in Azure
38
+
- A custom RBAC role for the resource in Azure
37
39
- An activation resource group and resource in Azure Stack
38
40
39
41
See documentation for more detail: https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-register
@@ -47,6 +49,10 @@ If not supplied script will request manual input of username and password
47
49
48
50
The subscription Id that will be used for marketplace syndication and usage. The Azure Account Id used during registration must have resource creation access to this subscription.
49
51
52
+
.PARAMETERAzureDirectoryTenantName
53
+
54
+
The Azure tenant directory where you would like your registration resource in Azure to be created.
55
+
50
56
.PARAMETERJeaComputerName
51
57
52
58
Just-Enough-Access Computer Name, also known as Emergency Console VM.(Example: AzS-ERCS01 for the ASDK)
@@ -69,15 +75,16 @@ The name of the Azure Environment where resources will be created. Defaults to "
69
75
70
76
.PARAMETERBillingModel
71
77
72
-
The billing model that the subscription uses. Select from "Capacity","PayAsYouUse", and "Development". Defaults to "Development". Please see documentation for more information: https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-billing-and-chargeback
78
+
The billing model that the subscription uses. Select from "Capacity","PayAsYouUse", and "Development". Defaults to "Development" which is usable for POC installments.
79
+
Please see documentation for more information: https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-billing-and-chargeback
73
80
74
81
.PARAMETERMarketplaceSyndicationEnabled
75
82
76
83
This is a switch that determines if this registration will allow you to download products from the Azure Marketplace. Defaults to $true
77
84
78
85
.PARAMETERUsageReportingEnabled
79
86
80
-
This is a switch that determines if usage records are reported to Azure. Defaults to $true
87
+
This is a switch that determines if usage records are reported to Azure. Defaults to $true. Note: This cannot be disabled with billing model set to PayAsYouUse.
81
88
82
89
.PARAMETERAgreementNumber
83
90
@@ -87,36 +94,31 @@ Used when the billing model is set to capacity. If this is the case you will nee
87
94
88
95
This example registers your AzureStack environment with Azure, enables syndication, and enables usage reporting to Azure.
This example registers your AzureStack environment with Azure, enables syndication and usage and gives a specific name to the resource group and registration resource.
If you would like to un-Register with you Azure by turning off marketplace syndication and usage reporting you can run this script again with both enableSyndication and reportUsage set to false.
113
-
This will unconfigure usage bridge so that syndication isn't possible and usage data is not reported. This is only possible with billing model of Development or Capacity.
119
+
If you would like to un-Register with you Azure by turning off marketplace syndication, disabling usage reporting, and removing the registration resource from Azure you can run Remove-AzsRegistration.
114
120
115
-
If you would like to use a different subscription for registration there are two functions to be run before re-registering:
116
-
- Add-RegistrationRoleAssignment: Use this function If your next subscription Id is under the same account as the current registration
117
-
- Remove-RegistrationResource: Use this function if your next subscription Id is under a different account than the current registration
118
-
119
-
Once you have run the appropriate function you can call RegisterWithAzure again to re-register.
121
+
If you would like to use a different subscription for registration you can run Set-AzsRegistrationSubscription
120
122
121
123
#>
122
124
@@ -186,14 +188,12 @@ Function Add-AzsRegistration{
186
188
187
189
.SYNOPSIS
188
190
189
-
Removes a registration resource from Azure
191
+
Sets current registration parameters MarketplaceSyndicationEnabled and EnableUsageReporting to $false, then removes registration resource from Azure.
190
192
191
193
.DESCRIPTION
192
194
193
195
If no registration resource name is supplied then then this script will use this environments CloudId to search for a registration resource and remove it from Azure.
194
-
If a RegistrationName and ResourceGroupName are supplied this script will remove the specified registration resource from Azure. This will disable marketplace syndication
195
-
and allow you to run RegisterWithAzure with a different subscription Id. Note: If the provided subscription for a subsequent RegisterWithAzure is under the same Azure Account
196
-
as the previous registration you MUST run Add-RegistrationRoleAssignment before attempting RegisterWithAzure.
196
+
If a RegistrationName and ResourceGroupName are supplied this script will remove the specified registration resource from Azure.
197
197
198
198
.PARAMETERCloudAdminCredential
199
199
@@ -204,6 +204,10 @@ If not supplied script will request manual input of username and password.
204
204
205
205
The subscription Id that was previously used to register this Azure Stack environment with Azure.
206
206
207
+
.PARAMETERAzureDirectoryTenantName
208
+
209
+
The Azure tenant directory previously used to register this Azure Stack environment with Azure.
210
+
207
211
.PARAMETERJeaComputerName
208
212
209
213
Just-Enough-Access Computer Name, also known as Emergency Console VM.(Example: AzS-ERCS01 for the ASDK).
@@ -214,23 +218,21 @@ This is the name of the resource group in Azure where the previous registration
214
218
215
219
.PARAMETERRegistrationName
216
220
217
-
This is the name of the previous registration resource that was created in Azure. This resource will be removed Defaults to "AzureStack-<CloudId>"
221
+
This is the name of the previous registration resource that was created in Azure. This resource will be removed. Defaults to "AzureStack-<CloudId>"
218
222
219
223
.PARAMETERAzureEnvironmentName
220
224
221
225
The name of the Azure Environment where registration resources have been created. Defaults to "AzureCloud"
222
226
223
227
.EXAMPLE
224
228
225
-
This example removes a registration resource in Azure that was created from a prior successful run of RegisterWithAzure and uses defaults for RegistrationName and ResourceGroupName.
229
+
This example removes a registration resource in Azure that was created from a prior successful run of Add-AzsRegistration and uses defaults for RegistrationName and ResourceGroupName.
This script should be used in conjuction with running RegisterWithAzure to disable marketplace syndication and usage reporting (if able). If after running this script
232
-
you attempt to re-register with a different subscription Id that is under the same account as the previous registration you will recieve an error related to the custom
233
-
RBAC role for registration resources. To fix this, please run Add-RegistrationRoleAssignment to re-register with a subscription under the previously registered account.
235
+
This will always set syndication and usage reporting to false as well as remove the provided registration resource from Azure.
234
236
235
237
#>
236
238
@@ -338,34 +340,61 @@ function Remove-AzsRegistration{
338
340
339
341
.SYNOPSIS
340
342
341
-
This script is used to prepare the current environment for registering with a new subscription Id under the same account.
343
+
Set-AzsRegistrationSubscription calls Remove-AzsRegistration on the current registration resource and then calls Add-AzsRegistration with the new parameters
342
344
343
345
.DESCRIPTION
344
346
345
-
Add-RegistrationRoleAssignment will add the provided alternate subscription Id to the list of assignable scopes for the custom RBAC role that is defined and assigned to registration resources.
346
-
This RBAC role is created / assigned during the RegisterWithAzure function.
347
+
Set-AzsRegistrationSubsription requires the parameters for the current registration as well as parameters for a new registration resource. The function
348
+
attempts to add the custom RBAC role created during Add-AzsRegistration to the new subscription passed in. If not possible the function will continue as normal.
349
+
Set-AzsRegistrationSubscription will call Remove-AzsRegistration on the current registration resource and then pass the new subscription Id and new
350
+
Azure directory tenant name into Add-AzsRegistration.
347
351
348
-
.PARAMETERAzureSubscriptionId
352
+
.PARAMETERCloudAdminCredential
353
+
354
+
Powershell object that contains credential information i.e. user name and password.The CloudAdmin has access to the JEA Computer (also known as Emergency Console) to call whitelisted cmdlets and scripts.
355
+
If not supplied script will request manual input of username and password.
356
+
357
+
.PARAMETERCurrentAzureSubscriptionId
349
358
350
359
The subscription Id that was previously used to register this Azure Stack environment with Azure.
351
360
352
-
.PARAMETERAlternateSubscriptionId
361
+
.PARAMETERAzureDirectoryTenantName
362
+
363
+
The Azure tenant directory previously used to register this Azure Stack environment with Azure.
353
364
354
-
The new subscription Id that this environment will be registered to in Azure.
365
+
.PARAMETERNewAzureSubscriptionId
366
+
367
+
The subscription Id you would like to change your registration to.
368
+
369
+
.PARAMETERJeaComputerName
370
+
371
+
Just-Enough-Access Computer Name, also known as Emergency Console VM.(Example: AzS-ERCS01 for the ASDK).
372
+
373
+
.PARAMETERNewAzureDirectoryTenantName
374
+
375
+
The new Azure tenant directory you would like used during registration. This can be the same as the previous tenant name.
376
+
377
+
.PARAMETERResourceGroupName
378
+
379
+
This is the name of the resource group in Azure where the previous registration resource was stored. Defaults to "azurestack"
380
+
381
+
.PARAMETERRegistrationName
382
+
383
+
This is the name of the previous registration resource that was created in Azure. This resource will be removed. Defaults to "AzureStack-<CloudId>"
355
384
356
385
.PARAMETERAzureEnvironmentName
357
386
358
387
The name of the Azure Environment where registration resources have been created. Defaults to "AzureCloud"
This function should only be used if you have a currently registered environment and would like to switch the subscription used to register to a different subscription
367
-
that is under the same account. If you would like to register to a subscription Id that is under a separate account then you must use Remove-RegistrationResource before
368
-
calling RegisterWithAzure again.
396
+
If you would like to register with a different resource group, resource name, or resource group location you cannot currently use Set-AzsRegistrationSubsription for that.
397
+
To do so you should call Remove-AzsRegistration followed by Add-AzsRegistration with the new parameters you would like.
369
398
370
399
#>
371
400
@@ -432,7 +461,7 @@ function Set-AzsRegistrationSubscription{
Log-Warning "Unable to add the new subscription: $NewAzureSubscriptionId to the scope of existing RBAC role definition. Continuing with transfer of registration"
479
+
Log-Warning "Unable to add the new subscription: $NewAzureSubscriptionId to the scope of existing RBAC role definition. Continuing with transfer of registration`r`n$($_.Exception)"
451
480
}
452
481
else
453
482
{
@@ -753,8 +782,8 @@ Determines if a new Azure connection is required.
753
782
754
783
.DESCRIPTION
755
784
756
-
If the current powershell environment is not currently logged in to an Azure Account or is calling either RegisterWithAzure or
757
-
Initialize-AlternateRegistration with a subscription id that does not match the current environment's subscription then Connect-AzureAccount will prompt the user to log in
785
+
If the current powershell environment is not currently logged in to an Azure Account or is calling Add-AzsRegistration
786
+
with a subscription id that does not match one available under the current context then Connect-AzureAccount will prompt the user to log in
758
787
to the correct account.
759
788
760
789
#>
@@ -1003,23 +1032,28 @@ function Get-TenantIdFromName
1003
1032
1004
1033
$response=Invoke-RestMethod-Uri $uri-Method Get -Verbose
1005
1034
1006
-
Write-Verbose-Message "using token_endpoint $($response.token_endpoint) to parse tenant id"-Verbose
0 commit comments