Azure / pcs-cli

A CLI for deploying Azure IoT PCS
MIT License
33 stars 37 forks source link

Subscription ID not found in cache #466

Closed gauravagerwala closed 3 years ago

gauravagerwala commented 5 years ago

Type of issue

Description

While trying to create a standard deployment using service principals it throws the following error :

Selected subscriptionId was not found in cache
Error: Selected subscriptionId was not found in cache
    at subPrompt.then (/home/learning/pcs-cli/publish/index.js:182:31)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

...

Steps to reproduce

  1. pcs -t remotemonitoring -s standard --servicePrincipalId {servicePrincipalId} --servicePrincipalSecret {servicePrincipalSecret}

Context and Environment

ppathan commented 5 years ago

@elvinm Can you look at this?

elvinm commented 5 years ago

ServicePrinicipalId and secret are used to do a non interactive deployment. In this scenario it is expected that the user has provided additional details. In this case you would need to use at least a command of the form:

--servicePrincipalId xxxx --servicePrincipalSecret xxxx --domainId xxxx --subscriptionId xxxx

The error logic handling should be cleaned up here to verify that all the parameters were provided so that it leads to a less confusing error message.

jasonb815 commented 5 years ago

even with all of the above information included I am getting this :

Successfully logged in Selected subscriptionId was not found in cache Error: Selected subscriptionId was not found in cache at subPrompt.then (/home/mqadmin/pcs-cli/publish/index.js:189:35) at processTicksAndRejections (internal/process/next_tick.js:81:5)

jasonb815 commented 5 years ago

@elvinm Any idea what's going on here and causing this?

elvinm commented 5 years ago

Are you perhaps using an older version of the CLI? What version is it (pcs --version)?

jasonb815 commented 5 years ago

@elvinm

pcs --version 2.2.1

I use the version deployed with NPM

any other suggestions??? @elvinm

jasonb815 commented 5 years ago

@elvinm @ppathan Any help here? This is still a problem...

ppathan commented 5 years ago

@jasonb815 Sometimes I have seen this error show up when 2-factor auth has been enabled by the tenant/subscription. Do you have 2-factor auth enabled for your account?

jasonb815 commented 5 years ago

yes, but we have created a service principal account to use during automated deployment of PCS and ther AZ services. It works fine with the AZ CLI, but gets this error with the PCS CLI. ??