Skip to content

Commit 4853bd4

Browse files
committed
Merge branch 'master' into CI
2 parents 804f867 + d9ffc9e commit 4853bd4

8 files changed

+144
-6913
lines changed

docs-conceptual/azps-1.4.0/authenticate-azureps.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: sttramer
66
manager: carmonm
77
ms.devlang: powershell
88
ms.topic: conceptual
9-
ms.date: 10/29/2018
9+
ms.date: 02/20/2019
1010
---
1111
# Sign in with Azure PowerShell
1212

@@ -43,18 +43,57 @@ $creds = Get-Credential
4343
Connect-AzAccount -Credential $creds
4444
```
4545

46-
## Sign in with a service principal
46+
## Sign in with a service principal <a name="sp-signin"/>
4747

4848
Service principals are non-interactive Azure accounts. Like other user accounts, their permissions are managed with Azure Active Directory. By granting a service principal only the permissions it needs, your automation scripts stay secure.
4949

5050
To learn how to create a service principal for use with Azure PowerShell, see [Create an Azure service principal with Azure PowerShell](create-azure-service-principal-azureps.md).
5151

5252
To sign in with a service principal, use the `-ServicePrincipal` argument with the `Connect-AzAccount` cmdlet. You'll also need the service principal's application ID,
53-
sign-in credentials, and the tenant ID associate with the service principal. To get the service principal's credentials as the appropriate object, use the [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential) cmdlet. This cmdlet will present a prompt for the service principal user ID and password.
53+
sign-in credentials, and the tenant ID associate with the service principal. How you sign in with a service principal will depend on whether it's configured for password-based or certificate-based authentication.
54+
55+
### Password-based authentication
56+
57+
To get the service principal's credentials as the appropriate object, use the [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential) cmdlet. This cmdlet will present a prompt for a username and password. Use the service principal ID for the username.
5458

5559
```azurepowershell-interactive
5660
$pscredential = Get-Credential
57-
Connect-AzAccount -ServicePrincipal -ApplicationId "http://my-app" -Credential $pscredential -TenantId $tenantid
61+
Connect-AzAccount -ServicePrincipal -Credential $pscredential -TenantId $tenantId
62+
```
63+
64+
### Certificate-based authentication
65+
66+
Certificate-based authentication requires that Azure PowerShell can retrieve information from a local certificate
67+
store based on a certificate thumbprint.
68+
69+
```azurepowershell-interactive
70+
Connect-AzAccount -ServicePrincipal -TenantId $tenantId -CertificateThumbprint <thumbprint>
71+
```
72+
73+
In PowerShell 5, the certificate store can be managed and inspected with the [PKI](/powershell/module/pkiclient) module. For PowerShell 6, the process is more complicated. The following scripts show you how to import an existing certificate into the certificate store accessible by PowerShell.
74+
75+
#### Import a certificate in PowerShell 5
76+
77+
```azurepowershell-interactive
78+
# Import a PFX
79+
$credentials = Get-Credential -Message "Provide PFX private key password"
80+
Import-PfxCertificate -FilePath <path to certificate> -Password $credentials.Password -CertStoreLocation cert:\CurrentUser\My
81+
```
82+
83+
#### Import a certificate in PowerShell 6
84+
85+
```azurepowershell-interactive
86+
# Import a PFX
87+
$storeName = [System.Security.Cryptography.X509Certificates.StoreName]::My
88+
$storeLocation = [System.Security.Cryptography.X509Certificates.StoreLocation]::CurrentUser
89+
$store = [System.Security.Cryptography.X509Certificates.X509Store]::new($storeName, $storeLocation)
90+
$certPath = <path to certificate>
91+
$credentials = Get-Credential -Message "Provide PFX private key password"
92+
$flag = [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable
93+
$certificate = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new($certPath, $credentials.Password, $flag)
94+
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
95+
$store.Add($Certificate)
96+
$store.Close()
5897
```
5998

6099
## Sign in using a managed identity

docs-conceptual/azps-1.4.0/create-azure-service-principal-azureps.md

Lines changed: 95 additions & 178 deletions
Large diffs are not rendered by default.

docs-conceptual/azps-1.4.0/install-az-ps.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ are supported.
1717

1818
## Requirements
1919

20-
Azure PowerShell works with PowerShell 5.1 or higher on Windows, or PowerShell 6.x on any platform.
20+
Azure PowerShell works with PowerShell 5.1 or higher on Windows, or PowerShell 6 on any platform.
2121
To check your PowerShell version, run the command:
2222

2323
```powershell-interactive
@@ -27,7 +27,7 @@ $PSVersionTable.PSVersion
2727
If you have an outdated version or need to install PowerShell, see [Installing various versions of PowerShell](/powershell/scripting/setup/installing-powershell). Install
2828
information for your platform is linked from that page.
2929

30-
If you are using PowerShell 5.x on Windows, you also need .NET Framework 4.7.2 installed. For instructions
30+
If you are using PowerShell 5 on Windows, you also need .NET Framework 4.7.2 installed. For instructions
3131
on updating or installing a new version of .NET Framework, see the [.NET Framework installation guide](/dotnet/framework/install).
3232

3333
## Install the Azure PowerShell module

docs-conceptual/azps-1.4.0/new-azureps-module-az.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Starting in December 2018, the Azure PowerShell Az module is in general release
1414
PowerShell module for interacting with Azure. Az offers shorter commands, improved stability, and
1515
cross-platform support. Az also offers feature parity and an easy migration path from AzureRM.
1616

17-
Az uses the .NET Standard library, which means it runs on PowerShell 5.x and PowerShell 6.x.
18-
Since PowerShell 6.x can run on Linux, macOS, and Windows, Azure PowerShell is now available for all platforms.
17+
Az uses the .NET Standard library, which means it runs on PowerShell 5 and PowerShell 6.
18+
Since PowerShell 6 can run on Linux, macOS, and Windows, Azure PowerShell is now available for all platforms.
1919
Using .NET Standard allows us to unify the code base of Azure PowerShell with minimal impact on users.
2020

2121
Az is a new module, so the version has been reset to 1.0.0.

docs-conceptual/azps-1.4.0/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Azure PowerShell is also available on Azure Cloud Shell.
1919
## About the new Az module
2020

2121
This documentation describes the new Az module for Azure PowerShell. This new module is written from the
22-
ground up in .NET Standard. Using .NET Standard allows Azure PowerShell to run under PowerShell 5.x on Windows
22+
ground up in .NET Standard. Using .NET Standard allows Azure PowerShell to run under PowerShell 5 on Windows
2323
or PowerShell 6 on any platform. The Az module is now the intended way to interact with Azure through PowerShell.
2424
AzureRM will continue to get bug fixes, but no longer receive new features.
2525

@@ -38,7 +38,7 @@ The [AzureRM documentation](/powershell/azure/azurerm) is also available.
3838
3939
## Run or install
4040

41-
You can install Azure PowerShell on any platform which supports PowerShell 5.x or PowerShell 6.x, or run
41+
You can install Azure PowerShell on PowerShell 5.1 or higher on Windows, PowerShell 6 on any platform, or run
4242
in Azure Cloud Shell.
4343

4444
* To run in your browser with Azure Cloud Shell, see [Quickstart for PowerShell in Azure Cloud Shell](/azure/cloud-shell/quickstart-powershell).

0 commit comments

Comments
 (0)