-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect-AzureRmAccount silently fails to log in when using -ServicePrincipal flag #6353
Comments
After adding the line Then I ran |
I have the same issue on Azure Functions App and finally found your post. I have already installed an recent AzureRM.Profile and AzureRM.Resource modules (not shown in the example) to the wwwroot/<func name>/Modules folder, so I'm not sure what I'm missing. The problem persists for me. Azure function output below. Note the empty values for Account, SubscriptionName, SubscriptionId, TenantId, and Environment.
|
I figured out what was wrong. For others who find my issue through google, see below for the explanation. In order for Azure Functions App to run Connect-AzureRmAccount, you need to manually install AzureRM.Profile and AzureRM.Resource through Kudu (zip em up, drop em in a modules folder under your function folder). My Azure Functions App was set to 32-bit by default (why 32-bit by default Azure team? this is 2018). The powershell modules I packed up and installed were 64-bit (because my dev machine runs 64-bit windows10). As soon as I toggled my Azure Functions App to 64-bit, the 64-bit AzureRM.Profile and AzureRM.Resource modules started working again. |
Actually let me correct myself. Connect-AzureRmAccount seems to enter a state where it will return empty results, but I can solve this by toggling between 32-bit and 64-bit execution |
I have experienced similar issue too. How I resolved this issue is a little bit different. I have two subscriptions, the service principal account I created would not be able to logon on. I tried to do above suggestions and did not work. Finally I found out that I can resolve this issue is to go to subscription, Access control, and give the reader role to SP account I created. Then everything works perfectly fine after. |
@wuy3 @jackyycheng Could you please provide more details on how was resolved? I created an Azure Function that will receive a PS Script as a parameter, but the problem is that "The term 'Connect-AzureRMAccount' is not recognized as the name of a cmdlet, function, script file, or operable program" I created a folder "modules" and copied "AzureRM.Profile" folder and "AzureRM.Resource" folder into it and it's not working, change from 32 to 64 bits, same.....What else needs to be changed on the Azure function? |
Description
I'm trying to connect to my subscription so that I can create resources and deploy web applications through PowerShell.
I'm using
Connect-AzureRmAccount
cmdlet with-ServicePrincipal
switch and-Credential
and-TenantId
arguments. The command does not throw an error and says the login was successful, but it does not return any information about the account / subscription / tenant, the command just outputs the following:The next AzureRM operation fails with an the following message:
Script/Steps for Reproduction
Module Version
Environment Data
Debug Output
The text was updated successfully, but these errors were encountered: