Questions tagged [azure-powershell]

The Azure module for PowerShell allows administrators to accomplish management tasks for Azure resources. The Az wrapper module includes only stable modules, the AzPreview wrapper module includes all PowerShell modules for Azure allowing to manage resources in all Azure services.

The Azure Modules for PowerShell allows administrators to accomplish many Azure management tasks through a series of cmdlets. The modules include the new Az module and the older AzureRM module (due to retire by Feb 2024).

References:

  1. Overview of Azure PowerShell

  2. PowerShell Module Browser: Search for PowerShell modules and cmdlets.

2843 questions
15
votes
1 answer

Azure Resource Group Stuck in "Moving Resources"

I was doing some cleanup moving some Azure Cloud Services to a newly created Resource group with the following command Find-AzureRmResource -ResourceNameContains "oldresourcename" | Move-AzureRmResource -DestinationResourceGroupName…
14
votes
2 answers

Upgrade AzureRM Powershell on Hosted 2017 Agent (VSTS - Visual Studio Team Services)

I am using release management through Visual Studio Teams Services (online). We use Hosted build Agents and I really want to avoid the overhead of managing custom agents. One item I do need is the AzureRM PowerShell module. Versions up to 5.1.1 are…
Murray Foxcroft
  • 12,785
  • 7
  • 58
  • 86
14
votes
2 answers

Authenticating with Azure Active Directory on powershell

I am attempting to explore the features of the Azure Active Directory V2 PowerShell Module I have an Azure Account, and I have set up an Active Directory with multiple users. My first goal is simple: show me the list of users. So I…
Andrew Shepherd
  • 44,254
  • 30
  • 139
  • 205
14
votes
5 answers

How to update Azure PowerShell?

I have Azure PowerShell 1.0.3 installed via the Gallery (per the instructions here in the Installing Azure PowerShell From The Gallery section). I want to update to the latest version but am unclear on the commands that I need to run. I tried the…
GregGalloway
  • 11,355
  • 3
  • 16
  • 47
13
votes
2 answers

azure pipeline - set variable based on triggered branch

i'm trying to set the BuildConfiguration based on the triggered branch using powershell anyone know how this could be done? switch($env:Build.SourceBranchName) { 'master' {$env:BuildConfiguration = Release; break;} 'staging'…
13
votes
7 answers

How to clean up bad Azure PowerShell uninstall?

Background: I had installed Azure-PowerShell 1.x via the MSI, and subsequently added some Azure Resource Management modules via the command prompt. Everything was working fine; then yesterday afternoon the ISE inexplicably disappeared. In an…
Mark Maslar
  • 1,121
  • 4
  • 16
  • 28
12
votes
2 answers

How to Get Azure AD Object by Object ID Using Azure CLI

In the Azure Portal, one can look-up an Azure AD object based on the Object ID as shown below: Is it possible to retrieve an Azure AD object by the Object ID using the Azure CLI? In order to use the Azure CLI to get the object related to the object…
PoorInRichfield
  • 1,436
  • 2
  • 19
  • 29
12
votes
3 answers

List of all azure resource types in Azure?

Is there anywhere you can get a full list of all the resource types offered by Azure? I'm doing policy/role management and there doesn't seem to be a great place to look for all resource types. Currently I've been using the…
12
votes
4 answers

Deployment slot specific appsettin in ARM template?

I'm trying to get into that Visual Studio Resource Group template. So far it's looking good, and I have added some appsettings for a web app, but my question is, how can I make them deployment slot specific? Is there something in the json for the…
11
votes
2 answers

"Could not find the module Az.Accounts with given version" error when running Azure DevOps job in Docker

I install PowerShell and Az module in container based on ubuntu:16.04 RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ wget https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb && \ …
kagarlickij
  • 7,327
  • 10
  • 36
  • 71
11
votes
3 answers

Azure Powershell: Az and AzureRM modules cannot be imported in the same session

I have the below script that needs to remove files from an Azure Storage Container that are older than 7 days and it has suddenly stopped working: $StorageAccountName = "#" $StorageAccountKey = "#" $ContainerName = "#" $CleanupOlderThanDays =…
Philip
  • 2,460
  • 4
  • 27
  • 52
11
votes
4 answers

Set-AzContext works in Azure Cloud Shell but doesn't in Azure PowerShell

When i execute following command Clear-AzureProfile Connect-AzAccount -TenantID xxxxxxxxxxxxxxxxxxx Set-AzContext -SubscriptionId xxxxxxxxxxxxxxxxxxx in Azure PowerShell i get this error. Set-AzContext : Please provide a valid tenant or a valid…
3355307
  • 1,508
  • 4
  • 17
  • 42
11
votes
2 answers

Login-AzureRmAccount return subscription but Get-AzureSubscription return empty

I am able to login successfully with the Login-AzureRmAccount. Also I am able to see my subscription in the return value of Login-AzureRmAccount. But after login, if I type Get-AzureSubscription it return empty. Find the below screenshot
11
votes
4 answers

How to set default storage Account for Azure RM Subscription

I am trying to set Azure Rm Subscription (Get-AzureRMSubscription) CurrentStorageAccount to a particular arm storage account (Get-AzureRmStorageAccount) and I am not able to find a cmdlet that does that. With regular old azure cmdlets I am able to…
11
votes
3 answers

How to remove all deployed resources based on deployment name in Azure

I'm working on provisioning new Azure environment using ARM templates. In order to deploy I use the Azure PowerShell New-AzureRmResourceGroupDeployment command, where I specify DeploymentName , ResourceGroupName etc. However, when I want to…