Azure / ng-deploy-azure

Deploy Angular apps to Azure using the Angular CLI
MIT License
79 stars 37 forks source link

Fails to find subscription #55

Closed slubowsky closed 4 years ago

slubowsky commented 4 years ago

Describe the bug Azure ng-deploy fails to find my Visual Studio Enterprise Azure subscription (that I have been using for some time and have many things deployed to) Ran ng add @azure/ng-deploy Got expected To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXXX to authenticate. Clicked the link, entered the code. Browser claimed success. Closed browser, saw following message: You don't have any active subscriptions. Head to https://azure.com/free and sign in. From there you can create a new subscription and then you can come back and try again.

Running it again it doesn't even bother trying to connect, just shows no subscription message immediately. Trying -m flag and passing various params didnt help either.

In contrast the VS Code extension for Azure Storage recommended by the readme has no problem. I am able to see and browse my storage containers.

Expected behavior Should be able to find my subscription and allow me to deploy.

Desktop (please complete the following information):

Additional context Angular cli 8.3.2

mbondoso commented 4 years ago

Same here

manekinekko commented 4 years ago

Thank you @slubowsky. We are going to investigate this.

839998664 commented 4 years ago

I am facing the same issue.

mithunshanbhag commented 4 years ago

Facing the same issue here when running ng add @azure/ng-deploy. PS: If it matters, I'm already logged in to azure using the azure CLI. Logging out and retrying the same command didn't help either.

loiane commented 4 years ago

Hi team, same here. Also tried to az login manually and then running the command again. Using Angular CLI v8.3.3, MacOS.

manekinekko commented 4 years ago

@loiane @mithunshanbhag @839998664 can you share more insights about your azure accounts? Are they personal accounts? Trial? Do you use corporate subscriptions?

We couldn't reproduce this issue with other testers.

loiane commented 4 years ago

@manekinekko I have a Visual Studio Enterprise (offer MSDN), prepaid account that is provided to MVPs.

khalilou88 commented 4 years ago

I get the same error but i didn't have a account. I created a free one but i continue having the same error.

839998664 commented 4 years ago

@manekinekko I am using Visual Studio Code IDE, Have two subscriptions on Azure Pay as you Go ones...On a Windows 10 machine...

manekinekko commented 4 years ago

Thanks, everyone for providing more details.

@softchris @shmool we probably some way to debug this issue. Any ideas?

joshdobbs commented 4 years ago

I am having the same issue. Is there a fix or workaround for this?

aandreev commented 4 years ago

Same issue. What can I do to help debug and fix this?

aalmacin commented 4 years ago

I am having the same issue. Is there a fix or workaround for this?

If you have a Service Principal, you can setting it manually. Try doing this before running ng add @azure/ng-deploy. This worked for me.

export CLIENT_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
export CLIENT_SECRET='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
export TENANT_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
export AZURE_SUBSCRIPTION_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

ng add @azure/ng-deploy
tconnellredmane commented 4 years ago

I have the same issue. I'm using a corporate account with multiple subscriptions. I am a contributor on all subscriptions, not an admin. I've also tried clearing the Azure cache, expiring the device credentials to force a login. Win10 using terminal in VSCode/separate cmd window.

Note that the azure ng elements are added and I can deploy manually through the portal.

CesarApodaca commented 4 years ago

I have the same issue, I have a Pay as Go subscription and it can't detect my subscription

harikvpy commented 4 years ago

Facing the same issue as well

harikvpy commented 4 years ago

As a temporary workaround, you can copy the dist files manually using Azure dashboard.

luchsamapparat commented 4 years ago

any chance that this gets fixed?

manekinekko commented 4 years ago

Here are 2 options to unblock you while we manage to reproduce this issue:

1/ Delete the local configuration file of this package:

Then re-run: ng add @azure/ng-deploy.

2/ If the issue persists, please use the secondary login method: https://github.com/Azure/ng-deploy-azure#continuous-integration-mode-

clashleyca commented 4 years ago

More specific instructions that worked for me

First - get a service principal

az ad sp create-for-rbac

Save the output you will need it later

{
  "appId": "<sp-app-id>",
  "displayName":..",
  "name": "...",
  "password": "<sp-password>",
  "tenant": "<sp-tenant>"
 }

Get your subscription ID https://docs.netapp.com/us-en/kubernetes-service/create-auth-credentials-on-azure.html#step-1-check-your-permissions

https://social.technet.microsoft.com/Forums/azure/en-US/5879574b-4b13-4fe5-8c33-0b7ab3987480/how-can-i-retrieve-my-azure-subscription-id?forum=windowsazurepurchasing

Set the environment variables for Continuous Integration mode

export CI=1
export CLIENT_ID=<sp-app-id>
export CLIENT_SECRET=<sp-password>
export TENANT_ID=<sp-tenant>
export AZURE_SUBSCRIPTION_ID=<azure_subscription_id>

Run again

ng add @azure/ng-deploy

erik-j commented 4 years ago

Same error. I have the service principal (and validated from azure-cli call). I am a total rookie and don't know what is meant by setting environment variables. I am running from Windows 10 powershell.

Hopefully the answer is simple. Thanks.

markau commented 4 years ago

Same issue, another Visual Studio Enterprise (MSDN) user.

asinNama commented 4 years ago

same issue.

mraible commented 4 years ago

I'm experiencing this same problem. As a workaround, I tried creating a new Azure account with a different email address. However, I can't figure out how to remove my cached credentials so I'm prompted to log in again. Does anyone know how to do that?

I just get the following from my old account.

$ ng add @azure/ng-deploy
Skipping installation: Package already installed
You don't have any active subscriptions. Head to https://azure.com/free and sign in. From there you can create a new subscription and then you can come back and try again.
shmool commented 4 years ago

Hi @mraible, Did you try running ng run proj-name:azureLogout? Before you try ng add again, make sure to delete azure.json if it was created. The message that the package is already installed should be fine, it's just the first step of installation, and it should perform all the other tasks.

BTW, I'm working on upgrading the azure packages, which should resolve the subscription issue.

BH4NG commented 3 years ago

Set the environment variables for Continuous Integration mode

export CI=1
export CLIENT_ID=<sp-app-id>
export CLIENT_SECRET=<sp-password>
export TENANT_ID=<sp-tenant>
export AZURE_SUBSCRIPTION_ID=<azure_subscription_id>

Run again

ng add @azure/ng-deploy

How do I set environment variables?

If I follow https://www.npmjs.com/package/@azure/ng-deploy and command ng add @azure/ng-deploy --manual I'm not prompted to pass args and the available options don't match up with these params..

If I just do ng add @azure/ng-deploy --manual -i="myazuresubcriptionguid" I get the same problem: You don't have any active subscriptions. LogoutCmd doesn't work either.

Seems like still the same problem as the original ticket.

I'm on Angular 11.2, Node 14.15, OS: win32 x64, typescript 4.1.5. My Azure account is personal, started as a free trial, upgraded to the Free Tier, Default plan, with active subscription.

az account show --output table gives me an environmentName, HomeTenantId, IsDefault, Name, State & TenantId. State is enabled.

Anyone got some tricks I can pull?

terr-steak commented 3 months ago

Here are 2 options to unblock you while we manage to reproduce this issue:

1/ Delete the local configuration file of this package:

  • Windows: %LOCALAPPDATA%\@azure\ng-deploy-nodejs\Config\ng-azure.json
  • macOS: $HOME/.config/configstore/@azure\ng-deploy-nodejs\Config\ng-azure.json

The file paths may be different on your machine, please read the conf package's doc for more details.

Then re-run: ng add @azure/ng-deploy.

2/ If the issue persists, please use the secondary login method: https://github.com/Azure/ng-deploy-azure#continuous-integration-mode-

Alternate MacOS File location if not using conf: ./Library/Preferences/@azure/ng-deploy-nodejs/ng-azure.json