Azure / ng-deploy-azure

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

Update dependencies and fix no subscriptions issue #55 #92

Closed shmool closed 4 years ago

shmool commented 4 years ago

Description

Update Azure and Angular packages, and fix issue #55:

The SDK's interactive login method doesn't always give the right credentials, due to multiple tenants of the account. This happens usually with personal / trial Azure accounts.

This error is described when running a different method (that is not used in this project) for trying to fetch the subscription with its ID with the wrong credentials. This is the code to run:

import { interactiveLogin } from '@azure/ms-rest-nodeauth';
import { SubscriptionClient } from '@azure/arm-subscriptions';

const subscriptionId = 'YOUR-SUBSCRIPTION-ID';

const creds = await interactiveLogin();
const client = new SubscriptionClient(creds);
const subsRes = await client.subscriptions.get(subscriptionId);

The error message, where and are the tenants' IDs:

"The access token is from the wrong issuer 'https://sts.windows.net/<tenant1>/'. It must match the tenant 'https://sts.windows.net/<tenant2>/' associated with this subscription. Please use the authority (URL) 'https://login.windows.net/<tenant2>' to get the token. Note, if the subscription is transferred to another tenant there is no impact to the services, but information about new tenant could take time to propagate (up to an hour). If you just transferred your subscription and see this error message, please try back later."

In addition, updating the packages required updates in the code due to API changes.

Type of change

Please delete options that are not relevant.

How to Test

Run ng add @azure/ng-deploy on an Angular project, and sign in with a personal Azure account. Before the fix you might get an error message saying you don't have any active subscriptions. After the fix you will be asked to log in again and the flow will continue.

Closing issue

Issue #55

Assignee

@shmool

Projects

https://github.com/azure/ms-rest-nodeauth https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/subscription/arm-subscriptions

sinedied commented 4 years ago

@shmool I will take a look at the failing tests today