File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
articles/virtual-machines/windows Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -42,15 +42,14 @@ Create a service principal with [New-AzADServicePrincipal](/powershell/module/az
42
42
43
43
``` azurepowershell
44
44
$sp = New-AzADServicePrincipal -DisplayName "PackerSP$(Get-Random)"
45
- $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($sp.Secret)
46
- $plainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
45
+ $plainPassword = (New-AzADSpCredential -ObjectId $sp.Id).SecretText
47
46
```
48
47
49
48
Then output the password and application ID.
50
49
51
50
``` powershell
52
51
$plainPassword
53
- $sp.ApplicationId
52
+ $sp.AppId
54
53
```
55
54
56
55
@@ -68,7 +67,7 @@ Create a file named *windows.json* and paste the following content. Enter your o
68
67
69
68
| Parameter | Where to obtain |
70
69
| -------------------------------------| ----------------------------------------------------|
71
- | * client_id* | View service principal ID with ` $sp.applicationId ` |
70
+ | * client_id* | View service principal ID with ` $sp.AppId ` |
72
71
| * client_secret* | View the auto-generated password with ` $plainPassword ` |
73
72
| * tenant_id* | Output from ` $sub.TenantId ` command |
74
73
| * subscription_id* | Output from ` $sub.SubscriptionId ` command |
You can’t perform that action at this time.
0 commit comments