Multiple_Matching_Token_Detected: Add-AzureAccount in Powershell - azure

When I try to run "Add-AzureAccount" command in the powershell, I encountered the error below:
I am using the latest Azure powershell version 0.87
Add-AzureAccount : multiple_matching_tokens_detected: The cache
contains multiple tokens satisfying the requirements. Call
AcquireToken again providing more requirements (e.g. UserId) At line:1
char:1
Add-AzureAccount
~~~~~~~~~~~~~~~~
CategoryInfo : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount

Go to C:\Users\<user>\AppData\Roaming\Windows Azure Powershell and delete WindowsAzureProfile.xml. That helped me.

Try downloading the latest version. There was an issue around collisions in the token store that was fixed.
https://github.com/Azure/azure-sdk-tools/releases/tag/v0.8.8-September2014

Related

The term 'Get-AzADServicePrincipal' is not recognized as the name of a cmdlet, function

I'm trying to set access policy in azure key vault by following below msdn docs
https://learn.microsoft.com/en-us/azure/key-vault/general/assign-access-policy-powershell
I followed the steps like installed AzureAd in the powershell and connected with azure. But when I run the next steps I'm facing the issue like
Get-AzADServicePrincipal : The term 'Get-AzADServicePrincipal' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-AzADServicePrincipal -SearchString PI
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzADServicePrincipal:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Not sure what are the steps I'm missing.
Try running the install again with -AllowClobber.
Install-Module -Name Az -AllowClobber
The command Get-AzADServicePrincipal is in the module Az.Resources. It does not a command of AzureAD module. For more details, please refer to here.
Regarding the issue, please refer to the following steps
Assign your account to Azure AD role
Script
Connect-AzAccount
Get-AzADServicePrincipal

Error while fetching AAD app information using Get-AzureADApplication

I am trying to fetch AAD app info using "Get-AzureADApplication" command. but getting the below error-
Get-AzureADApplication : You must call the Connect-AzureAD cmdlet before calling
any other cmdlets.
At C:\Users\v-pasahu\Desktop\Sample.ps1:18 char:11
+ if($app = Get-AzureADApplication -Filter "DisplayName eq '$($AppName) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureADApplication], AadNee
dAuthenticationException
+ FullyQualifiedErrorId : Microsoft.Open.Azure.AD.CommonLibrary.AadNeedAuthe
nticationException,Microsoft.Open.AzureAD16.PowerShell.GetApplication
According to the error message, you need to run the command Connect-AzureAD first.
Besides, if you do not install azure powershell module, you should install it before using azure ad powershell.
Looking at the comments you have said you want to run this in the non interactive flow. To do this you must follow the instructions here to log in as a service principal.
Alternatively depending on what you are trying to do you may find it easier to Login using the AzureRm cmdlets.

Get-AzureWebSite : Requested value 'PremiumV2' was not found

I added a new Premium V2 app service plan. Now when running Get-AzureWebSite in PowerShell I'm getting the following error message:
get-azurewebsite : Requested value 'PremiumV2' was not found.
At line:1 char:1
+ get-azurewebsite
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureWebsite], ArgumentException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Websites.GetAzureWebsiteCommand
What is the error about?
The old CmdLets are no longer well supported, and don't know about new features like Premium V2.
Try using the ARM based CmdLets instead, like Get-AzureRmWebApp.

Deploying a forked repro of an azure quick start template

newbie at Github.
I have forked the repro of Azure Quickstart Templates and changed the "install_lamp_moodle.sh" for the "moodle-singlevm-ubuntu" to fit my needs but I cant seem to be able to test this as every-time the newuserscript part of the azuredeploy.json template (which I have locally stored), fails
I have changed the path to the installscript URI from:
"installScriptUri": "[concat('https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/moodle-singlevm-ubuntu/', variables('installScriptName'))]",`
to
"installScriptUri": "[concat('https://github.com/albertramsbottom/azure-quickstart-templates/blob/master/moodle-singlevm-ubuntu/', variables('installScriptName'))]",
And I am using Azure power-shell to create the resource Group and run the template
fails every time on a 404 error for the newuserscript
Obviously doing something very silly here. As I do not know Github I dont want to make changes to anything and thought that by forking the repro I could attempt this. And I have no idea where is newuserscript lives, I assume its an extension for Linux.
New-AzureRmResourceGroupDeployment : 08:56:02 - Resource Microsoft.Compute/virtualMachines/extensions
'myVM/newuserscript' failed with message 'The resource operation completed with terminal
provisioning state 'Failed'.'At line:1 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName mygroup -TemplateFile C:\T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupDeploymentCommand
New-AzureRmResourceGroupDeployment : 08:56:02 - VM has reported a failure when processing extension 'newuserscript'.
Error message: "Script returned an error.
---stdout---
---errout---
install_lamp_moodle.sh: 6: install_lamp_moodle.sh: Syntax error: newline unexpected
".At line:1 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName mygroup -TemplateFile C:\T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupDeploymentCommand
I know this sounds like an Azure quickstart issue but I think it is really a lack of understanding of GitHub and how to use a forked repro
And I aslo assume this has noting to do with the moodle-singlevm-ubuntu template and has more to do with my idiocy :)
Sorry #
You want to link to the "raw" file URI like in the original template. So something like:
"installScriptUri": "[concat('https://raw.githubusercontent.com/albertramsbottom/azure-quickstart-templates/master/moodle-singlevm-ubuntu/', variables('installScriptName'))]"
Note that that location has to be publicly accessible. For a model on how to stage artifacts in a private location you can take a look at this repo:
https://github.com/bmoore-msft/AzureRM-Samples

"'Content-Type' is an unexpected token." error when using the Windows Azure PowerShell module

What ever command I run from the Windows Azure PowerShell module, I get the same error. Example:
Get-AzureStorageAccount : 'Content-Type' is an unexpected token. The expected token is '"' or '''. Line 2, position 18.
At line:1 char:24
+ Get-AzureStorageAccount <<<< -StorageAccountName "bzyeastussys"
+ CategoryInfo : CloseError: (:) [Get-AzureStorageAccount], XmlException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.StorageServices.GetAzureStorageAccountCommand
I am completely stumped on what the problem is.
I have successfully set my subscription details (I can do a "Get-AzureSubscription") but any command I use that is calling out to the Azure services gives me this error about "Content-Type" being an unexpected token. I am able to use the old "Windows Azure PowerShell Cmdlets" without issue.
Any ideas on what the issue with "Windows Azure PowerShell" might be?
Thanks.
The issue is down to there being an internet proxy being used. The request is being challenged for authentication, hence the error.

Resources