Skip to content

Commit aa50245

Browse files
author
BradleyBartlett
committed
Update RegisterWithAzure.psm1 for 1803 release
1 parent 4b1a4dd commit aa50245

File tree

2 files changed

+490
-212
lines changed

2 files changed

+490
-212
lines changed

Registration/README.md

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,108 @@
22

33
The functions in this module allow you to perform the steps of registering your Azure Stack with your Azure subscription. Additional details can be found in the [documentation](https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-register).
44

5-
These functions can be run on any machine that can invoke-command on the Privileged Endpoint. As a prerequisite, make sure that you have, and are an owner of, an Azure subscription and that you have installed the correct version of Azure Powershell as outlined here: [Install Powershell for Azure Stack](https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-powershell-install)
5+
These functions can be run on any machine that has access to the Privileged Endpoint. As a prerequisite, make sure that you have, and are an owner of, an Azure subscription and that you have installed the correct version of Azure Powershell as outlined here: [Install Powershell for Azure Stack](https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-powershell-install)
66

7-
Once you have downloaded this module, open an elevated instance of Powershell ISE and run the functions contained:
7+
Once you have downloaded the RegisterWithAzure.psm1 module, open an elevated instance of Powershell ISE and run the functions contained:
88

9-
To register with Azure and enable marketplace syndication and usage data reporting:
9+
### Import RegisterWithAzure.psm1
10+
To import the RegisterWithAzure.psm1 module, navigate to where the module was downloaded and run the below:
1011
```powershell
11-
Import-Module "<path to RegisterWithAzure.psm1>" -Force -Verbose
12-
Set-AzsRegistration -CloudAdminCredential $cloudAdminCredential -PrivilegedEndpoint $privilegedEndpoint -BillingModel PayAsYouUse
12+
Import-Module .\RegisterWithAzure.psm1 -Force -Verbose
1313
```
1414

15+
## Register in a connected environment
16+
In a connected environment, to register with Azure, allow the download of marketplace items, and start reporting usage data to Azure you must be logged in to the correct Azure Powershell context
17+
18+
### Set the correct Azure Powershell Context
19+
```powershell
20+
Login-AzureRmAccount -Subscription '<Your Azure Subscription>' -Environment '<The Azure Environment where subscription was created>'
21+
```
22+
23+
### Complete registration / activation
24+
Then you must run the below command from RegisterWithAzure.psm1:
25+
```powershell
26+
Set-AzsRegistration -PrivilegedEndpoint "<Computer Name>-ERCS01"
27+
```
28+
29+
## ## Change or remove registration in a disconnected environment
30+
### Remove Registration
1531
To remove the existing registration resource and disable marketplace syndication and usage data reporting:
1632
```powershell
17-
Remove-AzsRegistration -CloudAdminCredential $cloudAdminCredential -PrivilegedEndpoint $privilegedEndpoint
33+
Set-AzsRegistration -PrivilegedEndpoint "<Computer Name>-ERCS01"
1834
```
35+
[!NOTE] You must be logged in to the same Azure Powershell context that you ran Set-AzsRegistration under
1936

37+
### Switch registration to a new subscription
2038
To switch the existing registration to a new subscription or directory:
2139
```powershell
2240
# Remove the existing registration
23-
Remove-AzsRegistration -CloudAdminCredential $cloudAdminCredential -PrivilegedEndpoint $privilegedEndpoint
41+
Remove-AzsRegistration -PrivilegedEndpoint "<Computer Name>-ERCS01"
2442
# Set the Azure Powershell context to the appropriate subscription
2543
Set-AzureRmContext -SubscriptionId "<new subscription to register>"
2644
# Register with the new subscription
27-
Set-AzsRegistration -CloudAdminCredential $cloudAdminCredential -PrivilegedEndpoint $privilegedEndpoint -BillingModel PayAsYouUse
45+
Set-AzsRegistration -PrivilegedEndpoint "<Computer Name>-ERCS01" -BillingModel PayAsYouUse
2846
```
2947

30-
You must be logged into the appropriate Azure Powershell context that you wish to be used for registration of your Azure Stack environment
3148

32-
If you are registering in an internet-disconnected scenario you can run these functions:
49+
## Register in a disconnected environment
50+
If you are registering in an internet-disconnected scenario there are a few more steps to complete registration.
51+
1) Get registration token from Azure Stack
52+
2) Create registration resource in Azure
53+
3) Retrieve activation token from registration resource in Azure
54+
4) Create activation resource in Azure stack
55+
56+
### Get a registration token
57+
You must first retrieve a registration token from the Azure Stack environment
58+
```powershell
59+
# Retrieve a registration token and save it to the TokenOutputFilePath
60+
$TokenOutputFilePath = "<file path where token will be saved>"
61+
Get-AzsRegistrationToken -PrivilegedEndpoint "<Computer Name>-ERCS01" -BillingModel Capacity -AgreementNumber '<EA Agreement Number>' -TokenOutputFilePath $TokenOutputFilepath
62+
```
63+
64+
### Create a registration resource in Azure
65+
You must use the registration token created in the step above and perform the below command on a computer connected to public Azure
66+
[!NOTE] Remember to download and import the RegisterWithAzure.psm1 module before running the below commands
67+
```powershell
68+
# Log in to the correct Azure Powershell context
69+
Login-AzureRmAccount -Subscription '<Your Azure Subscription>' -Environment '<The Azure Environment where subscription was created>'
70+
# Create a registration resource in Azure
71+
Register-AzsEnvironment -RegistrationToken "<Registration token text value>"
72+
```
73+
74+
### Retrieve activation key
75+
An activation key is required to create an activation resource in Azure Stack. You can retrieve this from the registration resource in Azure.
76+
Run the below command under the same context as the step above:
77+
```powershell
78+
$KeyOutputFilePath = "<file path where key will be saved>"
79+
Get-AzsActivationKey -RegistrationName "<name of registration resource in Azure>" -KeyOutputFilePath $KeyOutputFilePath
80+
```
81+
82+
### Create activation resource in Azure Stack
83+
The activation key created above must be copied to the Azure Stack environment before registration / activation can be complete.
84+
Run the below commands to complete registration in a disconnected environment:
85+
```powershell
86+
New-AzsActivationResource -PrivilegedEndpoint "<Computer Name>-ERCS01" -ActivationKey "<activation key text value>"
87+
```
88+
89+
Registration and activation is now complete for a disconnected environment. If you need to change or update your registration in a disconnected environment follow the below instructions
90+
91+
## Change or remove registration in a disconnected environment
92+
### Remove activation resource from Azure Stack
93+
You must first remove the activation resource from your Azure Stack
94+
```powershell
95+
Remove-AzsActivationResource -PrivilegedEndpoint "<Computer Name>-ERCS01"
96+
```
3397

98+
### Remove registration resource from Azure
99+
Next you must remove the registration resource from Azure. The below command must be run on a computer with connection to public Azure and be logged in to the correct Azure Powershell context.
100+
You must provide either the registration token or the registration name to the below command:
34101
```powershell
35-
# Perform this function on the AzureStack Environment
36-
Get-AzsRegistrationToken -CloudAdminCredential $cloudAdminCredential -PrivilegedEndpoint $PrivilegedEndpoint -BillingModel Development -TokenOutputFilePath "C:\Temp\RegistrationToken.txt"
37-
# Copy the registration token from the TokenOutputFilePath and pass it to this function on the Azure / Internet connected machine
38-
Register-AzsEnvironment -RegistrationToken $yourRegistrationToken
39-
# To UnRegister you must have either the registration token originally used or the registration resource name
40-
UnRegister-AzsEnvironment -RegistrationName "AzureStack-cb1e5061-1d93-4836-81ea-3b74a1db857a"
102+
# Use the registration name
103+
UnRegister-AzsEnvironment -RegistrationName "<name of registration resource in Azure>"
104+
# Or use the registration token
105+
UnRegister-AzsEnvironment -RegistrationToken "<original registration token text value>"
41106
```
107+
### Repeat the process for registering in a disconnected environment
108+
Once the above steps are complete you must go through the steps for registering in a disconnected environment but you will need to update parameters on the registration token (if necessary) and ensure
109+
that commands performed on the public Azure connected machine are performed under the new Azure Powershell context.

0 commit comments

Comments
 (0)