-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOneScript.ps1
58 lines (42 loc) · 2.17 KB
/
OneScript.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# OneScript for Azure Stack Development Kit (ASDK)
Set-ExecutionPolicy Unrestricted -Force
Set-PSRepository `
-Name "PSGallery" `
-InstallationPolicy Trusted
# Install the AzureRM.Bootstrapper module. Select Yes when prompted to install NuGet
Install-Module -Name AzureRm.BootStrapper
# Install and import the API Version Profile required by Azure Stack into the current PowerShell session.
Use-AzureRmProfile -Profile 2018-03-01-hybrid -Force
Install-Module -Name AzureStack -RequiredVersion 1.5.0
# Change directory to the root directory.
cd \
# Enforce usage of TLSv1.2 to download the Azure Stack tools archive from GitHub
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
invoke-webrequest `
https://github.com/Azure/AzureStack-Tools/archive/master.zip `
-OutFile master.zip
# Expand the downloaded files.
expand-archive master.zip `
-DestinationPath . `
-Force
# Change to the tools directory.
cd AzureStack-Tools-master
#Enter-PSSession -ComputerName AzS-ERCS01 -ConfigurationName PrivilegedEndpoint
#Test-AzureStack
Set-ADDefaultDomainPasswordPolicy -MaxPasswordAge 180.00:00:00 -Identity azurestack.local
$ExecutionContext.SessionState.LanguageMode
# Add the Azure cloud subscription environment name. Supported environment names are AzureCloud or, if using a China Azure Subscription, AzureChinaCloud.
Add-AzureRmAccount -EnvironmentName "AzureCloud"
# Register the Azure Stack resource provider in your Azure subscription
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.AzureStack
#Import the registration module that was downloaded with the GitHub tools
Import-Module C:\AzureStack-Tools-master\Registration\RegisterWithAzure.psm1
#Register Azure Stack
$AzureContext = Get-AzureRmContext
$CloudAdminCred = Get-Credential -UserName AZURESTACK\CloudAdmin -Message "Enter the credentials to access the privileged endpoint."
Set-AzsRegistration `
-PrivilegedEndpointCredential $CloudAdminCred `
-PrivilegedEndpoint AzS-ERCS01 `
-BillingModel Development `
-RegistrationName "TSC"
#note - you will have to change the -RegistrationName to be unique