Wednesday, September 28, 2016

Connecting to Azure using a publish settings file


For many automated data center operations, manually entering user credentials for each PowerShell session (or every 12 hours) can be cumbersome. Alternatively, a publish settings file can be downloaded from Azure that allows PowerShell sessions to connect without entering user credentials.This is useful for highly automated processes that do not have human interaction (such as a scheduled backup job).


To connect to Azure using a publish settings file, we will use the following steps to retrieve and import an Azure publish settings file:

1. Open Microsoft Azure PowerShell from the Start menu.

2. Enter the Get-AzurePublishSettingsFile cmdlet and press Enter, as shown here:

3. The Microsoft Azure portal will be opened in Internet Explorer. If prompted, enter your credentials to log in to the Azure portal.

4. If you have multiple subscriptions associated with your account, you will be prompted to select a subscription, as shown in the following screenshot:


5. When prompted to download the Azure publish settings file, save it to the local computer:


6.In the PowerShell window, use the Import-AzurePublishSettingsFile cmdlet (as shown below) to import the Azure publish settings file,which was downloaded in the previous step (PS C:\> Import-AzurePublishSettingsFile C:\Files\Azure.publishsettings):

Whether we used the Azure Active Directory credentials method or Azure's publish settings file method, we are now connected to Microsoft Azure in our PowerShell session.
 




 

Featured Posts

Adding Accesspolicy to KeyVault for Service Principal Using Portal and Powershell

  Scripts path : https://drive.google.com/drive/folders/1sbBpnVFgXhUIXLdf2E9heyWDeU2f9427?usp=sharing  Adding Accesspolicy to KeyVault for S...