|
1 | 1 | <meta name="google-site-verification" content="tZgbB2s-hTI0IePQQRCjHqL_Vf0j_XJmehXAHJerrn4" />
|
2 | 2 |
|
3 |
| -# Microsoft Azure PowerShell |
| 3 | +# ![AzureIcon] ![PowershellIcon] Microsoft Azure PowerShell |
4 | 4 |
|
5 |
| -This repository contains a set of PowerShell cmdlets for developers and administrators to develop, deploy and manage Microsoft Azure applications. |
| 5 | +This repository contains PowerShell cmdlets for developers and administrators to develop, deploy, and manage Microsoft Azure applications. |
6 | 6 |
|
7 |
| -Take a test run now from Azure Cloud Shell! |
8 |
| - |
9 |
| -[](https://shell.azure.com/powershell) |
| 7 | +Try it out in Azure Cloud Shell! |
10 | 8 |
|
| 9 | +[![CloudShellIcon]][CloudShell] |
11 | 10 |
|
12 | 11 | ## Modules
|
| 12 | +Below is a table containing our Azure PowerShell rollup module. |
13 | 13 |
|
14 |
| -Below is a table containing the various Azure PowerShell rollup modules found in this repository. For a full list of modules found in this repository, please see the [Azure PowerShell Modules](documentation/azure-powershell-modules.md) page. |
| 14 | +Description | Module Name | PowerShell Gallery Link |
| 15 | +------------------------------------- | --------------------------------------- | ----------------------- |
| 16 | +Azure PowerShell | `Az` | [![Az]][AzGallery] |
15 | 17 |
|
16 |
| -| Description | Module Name | PowerShell Gallery Link | |
17 |
| -| --------------------------------------------------------------- | ----------------- | ----------------------- | |
18 |
| -| Rollup Module for ARM Cmdlets | `AzureRM` | [](https://www.powershellgallery.com/packages/AzureRM/) | |
19 |
| -| Rollup Module for .NET Standard cmdlets | `Az` | [](https://www.powershellgallery.com/packages/Az/) | |
20 |
| -| Rollup Module for Administrative Modules in Azure Stack | `AzureStack` | [](https://www.powershellgallery.com/packages/AzureStack/) | |
21 |
| -| Rollup Module for Service Management Cmdlets | `Azure` | [](https://www.powershellgallery.com/packages/Azure/) | |
| 18 | +For a full list of modules found in this repository, please see the [Azure PowerShell Modules][AzurePowerShelModules] document. |
22 | 19 |
|
23 | 20 | ## Installation
|
24 | 21 |
|
25 |
| -For more detailed instructions on installing Azure PowerShell, please refer to the [installation guide](https://docs.microsoft.com/en-us/powershell/azure/install-azurerm-ps). |
26 |
| - |
27 | 22 | ### PowerShell Gallery
|
28 | 23 |
|
29 |
| -Run the following command in an elevated PowerShell session to install the rollup module for Azure Resource Manager cmdlets: |
30 |
| - |
31 |
| -```powershell |
32 |
| -Install-Module -Name AzureRM |
33 |
| -``` |
34 |
| - |
35 |
| -Run the following command in an elevated PowerShell session to install the new 'Az' module for ResourceManager cmdlets. This module runs on PowerShell 5.1 (with .Net Framework 4.7.2) , or PowerShell Core, and replaces AzureRM. You should not install this module side-by-side with AzureRM: |
| 24 | +Run the following command in an elevated PowerShell session to install the rollup module for Azure PowerShell cmdlets: |
36 | 25 |
|
37 | 26 | ```powershell
|
38 | 27 | Install-Module -Name Az
|
39 | 28 | ```
|
40 | 29 |
|
41 |
| -To install the module containing the legacy RDFE cmdlets, run the following command in an elevated PowerShell session: |
| 30 | +This module runs on Windows PowerShell with [.NET Framework 4.7.2][DotNetFramework] or greater, or [PowerShell Core][PowerShellCore]. The Az module replaces AzureRM. You should not install Az side-by-side with AzureRM. |
42 | 31 |
|
43 |
| -```powershell |
44 |
| -Install-Module -Name Azure |
45 |
| -``` |
46 |
| - |
47 |
| -If you have an earlier version of the Azure PowerShell modules installed from the PowerShell Gallery and would like to update to the latest version, run the following commands in an elevated PowerShell session. Update-Module installs the new version side-by-side with the old version. It does not remove the old version. |
| 32 | +If you have an earlier version of the Azure PowerShell modules installed from the PowerShell Gallery and would like to update to the latest version, run the following commands in an elevated PowerShell session: |
48 | 33 |
|
49 | 34 | ```powershell
|
50 |
| -# Update to the latest version of AzureRM |
51 |
| -Update-Module -Name AzureRM |
52 |
| -
|
53 |
| -# Update to the latest version of Az |
54 | 35 | Update-Module -Name Az
|
55 |
| -
|
56 |
| -# Update to the latest version of Azure |
57 |
| -Update-Module -Name Azure |
58 | 36 | ```
|
59 | 37 |
|
60 |
| -### Web Platform Installer |
| 38 | +`Update-Module` installs the new version side-by-side with previous versions. It does not uninstall the previous versions. |
61 | 39 |
|
62 |
| -Download and install the [Microsoft Web Platform Installer](https://www.microsoft.com/web/downloads/platform.aspx). Once installed, open the program and search for _Microsoft Azure PowerShell_. Click the _Add_ button followed by the _Install_ button at the bottom to begin the installation process. |
| 40 | +For detailed instructions on installing Azure PowerShell, please refer to the [installation guide][InstallationGuide]. |
63 | 41 |
|
64 | 42 | ## Usage
|
65 | 43 |
|
66 |
| -For more detailed instructions on using Azure PowerShell, please refer to the [getting started guide](https://docs.microsoft.com/en-us/powershell/azure/get-started-azureps). |
67 |
| - |
68 |
| -### Log in to Azure |
| 44 | +### Log into Azure |
69 | 45 |
|
70 |
| -To connect to Azure, use the [`Connect-AzureRmAccount`](https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/connect-azurermaccount) cmdlet. |
| 46 | +To connect to Azure, use the [Connect-AzAccount][ConnectAzAccount] cmdlet: |
71 | 47 |
|
72 | 48 | ```powershell
|
73 |
| -# Interactive login - you will get a dialog box asking for your Azure credentials |
74 |
| -Connect-AzureRmAccount |
| 49 | +# Device Code login - Provides a link to sign into Azure via your web browser |
| 50 | +Connect-AzAccount |
75 | 51 |
|
76 |
| -# Non-interactive login - you will need to use a service principal |
77 |
| -Connect-AzureRmAccount -ServicePrincipal -ApplicationId "http://my-app" -Credential $PSCredential -TenantId $TenantId |
| 52 | +# Service Principal login - Use a previously created service principal to log in |
| 53 | +Connect-AzAccount -ServicePrincipal -ApplicationId 'http://my-app' -Credential $PSCredential -TenantId $TenantId |
78 | 54 | ```
|
79 | 55 |
|
80 | 56 | To log into a specific cloud (_AzureChinaCloud_, _AzureCloud_, _AzureGermanCloud_, _AzureUSGovernment_), use the `Environment` parameter:
|
81 | 57 |
|
82 | 58 | ```powershell
|
83 |
| -# Log into a specific cloud - in this case, the Azure China cloud |
84 |
| -Connect-AzureRmAccount -Environment AzureChinaCloud |
| 59 | +# Specific cloud login - Logs into the Azure China cloud |
| 60 | +Connect-AzAccount -Environment AzureChinaCloud |
85 | 61 | ```
|
86 | 62 |
|
87 |
| -### Getting and setting your session context |
| 63 | +### Getting and setting your Azure PowerShell session context |
88 | 64 |
|
89 |
| -To view the context you are using in the current session, which contains the subscription and tenant, use the [`Get-AzureRmContext`](https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/get-azurermcontext) cmdlet: |
| 65 | +A session context persists login information across Azure PowerShell modules and PowerShell instances. To view the context you are using in the current session, which contains the subscription and tenant, use the [Get-AzContext][GetAzContext] cmdlet: |
90 | 66 |
|
91 | 67 | ```powershell
|
92 |
| -# Get the context you are currently using |
93 |
| -Get-AzureRmContext |
| 68 | +# Gets the Azure PowerShell context for the current PowerShell session |
| 69 | +Get-AzContext |
94 | 70 |
|
95 |
| -# List all available contexts in the current session |
96 |
| -Get-AzureRmContext -ListAvailable |
| 71 | +# Lists all available Azure PowerShell contexts in the current PowerShell session |
| 72 | +Get-AzContext -ListAvailable |
97 | 73 | ```
|
98 | 74 |
|
99 |
| -To get the subscriptions in a tenant, use the [`Get-AzureRmSubscription`](https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/get-azurermsubscription) cmdlet: |
| 75 | +To get the subscriptions in a tenant, use the [Get-AzSubscription][GetAzSubscription] cmdlet: |
100 | 76 |
|
101 | 77 | ```powershell
|
102 |
| -# Get all of the subscriptions in your current tenant |
103 |
| -Get-AzureRmSubscription |
| 78 | +# Get all of the Azure subscriptions in your current Azure tenant |
| 79 | +Get-AzSubscription |
104 | 80 |
|
105 |
| -# Get all of the subscriptions in a specific tenant |
106 |
| -Get-AzureRmSubscription -TenantId $TenantId |
| 81 | +# Get all of the Azure subscriptions in a specific Azure tenant |
| 82 | +Get-AzSubscription -TenantId $TenantId |
107 | 83 | ```
|
108 | 84 |
|
109 |
| -To change the subscription that you are using for your current context, use the [`Set-AzureRmContext`]() cmdlet: |
| 85 | +To change the subscription that you are using for your current context, use the [Set-AzContext][SetAzContext] cmdlet: |
110 | 86 |
|
111 | 87 | ```powershell
|
112 |
| -# Set the context to a specific subscription |
113 |
| -Set-AzureRmContext -Subscription $SubscriptionName -Name "MyContext" |
| 88 | +# Set the Azure PowerShell context to a specific Azure subscription |
| 89 | +Set-AzContext -Subscription $SubscriptionName -Name 'MyContext' |
114 | 90 |
|
115 |
| -# Set the context using piping |
116 |
| -Get-AzureRmSubscription -SubscriptionName $SubscriptionName | Set-AzureRmContext -Name "MyContext" |
| 91 | +# Set the Azure PowerShell context using piping |
| 92 | +Get-AzSubscription -SubscriptionName $SubscriptionName | Set-AzureRmContext -Name 'MyContext' |
117 | 93 | ```
|
118 | 94 |
|
| 95 | +For details on Azure PowerShell contexts, see our [persisted credentials guide][PersistedCredentialsGuide]. |
| 96 | + |
119 | 97 | ### Discovering cmdlets
|
120 | 98 |
|
121 | 99 | Use the `Get-Command` cmdlet to discover cmdlets within a specific module, or cmdlets that follow a specific search pattern:
|
122 | 100 |
|
123 | 101 | ```powershell
|
124 |
| -# View all cmdlets in the AzureRM.Profile module |
125 |
| -Get-Command -Module AzureRM.Profile |
| 102 | +# List all cmdlets in the Az.Accounts module |
| 103 | +Get-Command -Module Az.Accounts |
126 | 104 |
|
127 |
| -# View all cmdlets that contain "VirtualNetwork" |
128 |
| -Get-Command -Name "*VirtualNetwork*" |
| 105 | +# List all cmdlets that contain VirtualNetwork |
| 106 | +Get-Command -Name '*VirtualNetwork*' |
129 | 107 |
|
130 |
| -# View all cmdlets that contain "VM" in the AzureRM.Compute module |
131 |
| -Get-Command -Module AzureRM.Compute -Name "*VM*" |
| 108 | +# List all cmdlets that contain VM in the Az.Compute module |
| 109 | +Get-Command -Module Az.Compute -Name '*VM*' |
132 | 110 | ```
|
133 | 111 |
|
134 | 112 | ### Cmdlet help and examples
|
135 | 113 |
|
136 | 114 | To view the help content for a cmdlet, use the `Get-Help` cmdlet:
|
137 | 115 |
|
138 | 116 | ```powershell
|
139 |
| -# View the basic help content for Get-AzureRmSubscription |
140 |
| -Get-Help -Name Get-AzureRmSubscription |
| 117 | +# View the basic help content for Get-AzSubscription |
| 118 | +Get-Help -Name Get-AzSubscription |
141 | 119 |
|
142 |
| -# View the examples for Get-AzureRmSubscription |
143 |
| -Get-Help -Name Get-AzureRmSubscription -Examples |
| 120 | +# View the examples for Get-AzSubscription |
| 121 | +Get-Help -Name Get-AzSubscription -Examples |
144 | 122 |
|
145 |
| -# View the full help content for Get-AzureRmSubscription |
146 |
| -Get-Help -Name Get-AzureRmSubscription -Full |
| 123 | +# View the full help content for Get-AzSubscription |
| 124 | +Get-Help -Name Get-AzSubscription -Full |
147 | 125 |
|
148 |
| -# View the help content for Get-AzureRmSubscription on https://docs.microsoft.com |
149 |
| -Get-Help -Name Get-AzureRmSubscription -Online |
| 126 | +# View the help content for Get-AzSubscription on https://docs.microsoft.com |
| 127 | +Get-Help -Name Get-AzSubscription -Online |
150 | 128 | ```
|
151 | 129 |
|
| 130 | +For detailed instructions on using Azure PowerShell, please refer to the [getting started guide][GettingStartedGuide]. |
| 131 | + |
152 | 132 | ## Reporting Issues and Feedback
|
153 | 133 |
|
154 | 134 | ### Issues
|
155 | 135 |
|
156 |
| -If you find any bugs when using the Azure PowerShell modules, please file an issue [here](https://github.com/Azure/azure-powershell/issues), making sure to fill out the provided template with the appropriate information. |
| 136 | +If you find any bugs when using the Azure PowerShell modules, please file an issue in our [GitHub issues][GitHubIssues] page. Please fill out the provided template with the appropriate information. |
157 | 137 |
|
158 |
| -Alternatively, be sure to check out the [Azure Support Community](https://azure.microsoft.com/en-us/support/forums/) if you have trouble with any of the cmdlets or Azure services. |
| 138 | +Alternatively, be sure to check out the [Azure Community Support](https://azure.microsoft.com/en-us/support/community/) if you have issues with the cmdlets or Azure services. |
159 | 139 |
|
160 | 140 | ### Feedback
|
161 | 141 |
|
162 |
| -If there is a feature you would like to see in Azure PowerShell, please use the [`Send-Feedback`](https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/send-feedback) cmdlet, or file an issue [here](https://github.com/Azure/azure-powershell/issues), to send the team direct feedback. |
| 142 | +If there is a feature you would like to see in Azure PowerShell, please use the [Send-Feedback][SendFeedback] cmdlet, or file an issue in our [GitHub issues][GitHubIssues] page to provide the Azure PowerShell team direct feedback. |
163 | 143 |
|
164 | 144 | ## Contribute Code
|
165 | 145 |
|
166 |
| -If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](https://azure.github.io/guidelines/). |
| 146 | +If you would like to become an active contributor to this project, please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines][ContributionGuidelines]. |
167 | 147 |
|
168 |
| -More information about contributing to this repo can be found in [CONTRIBUTING md](https://github.com/Azure/azure-powershell/blob/preview/CONTRIBUTING.md) and the [Azure PowerShell Developer Guide](https://github.com/Azure/azure-powershell/blob/preview/documentation/development-docs/azure-powershell-developer-guide.md) folder. |
| 148 | +Additional information about contributing to this repository can be found in the [Contributing][Contributing] document and the [Azure PowerShell Developer Guide][DeveloperGuide] document. |
169 | 149 |
|
170 | 150 | ## Learn More
|
171 | 151 |
|
172 |
| -* [Microsoft Azure Documentation](https://docs.microsoft.com/en-us/azure/) |
173 |
| -* [PowerShell Documentation](https://docs.microsoft.com/en-us/powershell/) |
| 152 | +* [Microsoft Azure Documentation][MicrosoftAzureDocs] |
| 153 | +* [PowerShell Documentation][PowerShellDocs] |
174 | 154 |
|
175 | 155 | ---
|
176 |
| -_This project has adopted the [Microsoft Open Source Code of Conduct ](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. _ |
| 156 | +_This project has adopted the [Microsoft Open Source Code of Conduct ][CodeOfConduct]. For more information see the [Code of Conduct FAQ ][CodeOfConductFaq] or contact [[email protected]][OpenCodeEmail] with any additional questions or comments. _ |
| 157 | + |
| 158 | +<!-- References --> |
| 159 | + |
| 160 | +<!-- Local --> |
| 161 | +[GitHubIssues]: https://github.com/Azure/azure-powershell/issues |
| 162 | + |
| 163 | +[Contributing]: CONTRIBUTING.md |
| 164 | + |
| 165 | +[AzureIcon]: documentation/MicrosoftAzure-32px.png |
| 166 | +[PowershellIcon]: documentation/MicrosoftPowerShellCore-32px.png |
| 167 | +[AzurePowerShelModules]: documentation/azure-powershell-modules.md |
| 168 | +[DeveloperGuide]: documentation/development-docs/azure-powershell-developer-guide.md |
| 169 | + |
| 170 | +<!-- External --> |
| 171 | +[Az]: https://img.shields.io/powershellgallery/v/Az.svg?style=flat-square&label=Az |
| 172 | +[AzGallery]: https://www.powershellgallery.com/packages/Az/ |
| 173 | + |
| 174 | +[DotNetFramework]: https://dotnet.microsoft.com/download/dotnet-framework-runtime |
| 175 | +[PowerShellCore]: https://github.com/PowerShell/PowerShell/releases/latest |
| 176 | + |
| 177 | +[CloudShell]: https://shell.azure.com/powershell |
| 178 | +[CloudShellIcon]: https://shell.azure.com/images/launchcloudshell.png "Launch Azure Cloud Shell" |
| 179 | + |
| 180 | +[ContributionGuidelines]: https://azure.github.io/guidelines/ |
| 181 | +[CodeOfConduct]: https://opensource.microsoft.com/codeofconduct/ |
| 182 | +[CodeOfConductFaq]: https://opensource.microsoft.com/codeofconduct/faq/ |
| 183 | +[OpenCodeEmail]: mailto:[email protected] |
| 184 | + |
| 185 | +<!-- Docs --> |
| 186 | +[MicrosoftAzureDocs]: https://docs.microsoft.com/en-us/azure/ |
| 187 | +[PowerShellDocs]: https://docs.microsoft.com/en-us/powershell/ |
| 188 | + |
| 189 | +[InstallationGuide]: https://docs.microsoft.com/en-us/powershell/azure/install-azurerm-ps |
| 190 | +[GettingStartedGuide]: https://docs.microsoft.com/en-us/powershell/azure/get-started-azureps |
| 191 | +[PersistedCredentialsGuide]: https://docs.microsoft.com/en-us/powershell/azure/context-persistence |
| 192 | + |
| 193 | +[ConnectAzAccount]: https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/connect-azurermaccount |
| 194 | +[GetAzContext]: https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/get-azurermcontext |
| 195 | +[GetAzSubscription]: https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/get-azurermsubscription |
| 196 | +[SetAzContext]: https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/set-azurermcontext |
| 197 | +[SendFeedback]: https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/send-feedback |
0 commit comments