Azure / pcs-cli

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

Local deploy variable export error #491

Closed albertinisg closed 3 years ago

albertinisg commented 5 years ago

Type of issue

Description

When running:

pcs -t remotemonitoring -s local

It deploys all the resources, but fails exporting the env variables. It returns a bunch of errors bad variable name:

/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
Failed to set environment variable. envvar = 'PCS_ASA_DATA_AZUREBLOB_KEY="XXXXXXXXXXXXXXXXXXX==")', cmd = 'export PCS_ASA_DATA_AZUREBLOB_KEY "XXXXXXXXXXXXXXXXXXX=="', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
/bin/sh: 1: export: core.windows.net: bad variable name
Failed to set environment variable. envvar = 'PCS_ASA_DATA_AZUREBLOB_ENDPOINT_SUFFIX=core.windows.net)', cmd = 'export PCS_ASA_DATA_AZUREBLOB_ENDPOINT_SUFFIX core.windows.net', error = '/bin/sh: 1: export: core.windows.net: bad variable name
'
/bin/sh: 1: export: eventhub-xmkog: bad variable name
Failed to set environment variable. envvar = 'PCS_EVENTHUB_NAME="eventhub-xmkog")', cmd = 'export PCS_EVENTHUB_NAME "eventhub-xmkog"', error = '/bin/sh: 1: export: eventhub-xmkog: bad variable name
'
/bin/sh: 1: export: actions-eventhub-xmkog: bad variable name
Failed to set environment variable. envvar = 'PCS_ACTION_EVENTHUB_NAME="actions-eventhub-xmkog")', cmd = 'export PCS_ACTION_EVENTHUB_NAME "actions-eventhub-xmkog"', error = '/bin/sh: 1: export: actions-eventhub-xmkog: bad variable name
'
/bin/sh: 1: export: https://sts.windows.net/XXXXXXXXXXXXXXXXXXX/: bad variable name
Failed to set environment variable. envvar = 'PCS_AUTH_ISSUER="https://sts.windows.net/XXXXXXXXXXXXXXXXXXX/")', cmd = 'export PCS_AUTH_ISSUER "https://sts.windows.net/XXXXXXXXXXXXXXXXXXX/"', error = '/bin/sh: 1: export: https://sts.windows.net/XXXXXXXXXXXXXXXXXXX/: bad variable name
'
/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
Failed to set environment variable. envvar = 'PCS_AUTH_AUDIENCE=XXXXXXXXXXXXXXXXXXX)', cmd = 'export PCS_AUTH_AUDIENCE XXXXXXXXXXXXXXXXXXX', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX.env.timeseries.azure.com: bad variable name
Failed to set environment variable. envvar = 'PCS_TSI_FQDN="XXXXXXXXXXXXXXXXXXX.env.timeseries.azure.com")', cmd = 'export PCS_TSI_FQDN "XXXXXXXXXXXXXXXXXXX.env.timeseries.azure.com"', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX.env.timeseries.azure.com: bad variable name
'
/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
Failed to set environment variable. envvar = 'PCS_AAD_TENANT=XXXXXXXXXXXXXXXXXXX)', cmd = 'export PCS_AAD_TENANT XXXXXXXXXXXXXXXXXXX', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
Failed to set environment variable. envvar = 'PCS_AAD_APPID=XXXXXXXXXXXXXXXXXXX)', cmd = 'export PCS_AAD_APPIDXXXXXXXXXXXXXXXXXXX', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
/bin/sh: 1: export: 3fe21d1a-4d34-4648-af4b-25ad4bf4c604: bad variable name
Failed to set environment variable. envvar = 'PCS_SUBSCRIPTION_ID=3fe21d1a-4d34-4648-af4b-25ad4bf4c604)', cmd = 'export PCS_SUBSCRIPTION_ID XXXXXXXXXXXXXXXXXXX', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
/bin/sh: 1: export: iot-test: bad variable name
Failed to set environment variable. envvar = 'PCS_SOLUTION_NAME=iot-test)', cmd = 'export PCS_SOLUTION_NAME iot-test', error = '/bin/sh: 1: export: iot-test: bad variable name
'
/bin/sh: 1: export: http://localhost:8080: bad variable name
Failed to set environment variable. envvar = 'PCS_SOLUTION_WEBSITE_URL="http://localhost:8080")', cmd = 'export PCS_SOLUTION_WEBSITE_URL "http://localhost:8080"', error = '/bin/sh: 1: export: http://localhost:8080: bad variable name
'
/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
Failed to set environment variable. envvar = 'PCS_DEPLOYMENT_ID=XXXXXXXXXXXXXXXXXXX)', cmd = 'export PCS_DEPLOYMENT_ID XXXXXXXXXXXXXXXXXXX', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
/bin/sh: 1: export: iothub-xmkog: bad variable name
Failed to set environment variable. envvar = 'PCS_IOTHUB_NAME=iothub-xmkog)', cmd = 'export PCS_IOTHUB_NAME iothub-xmkog', error = '/bin/sh: 1: export: iothub-xmkog: bad variable name
'
/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
Failed to set environment variable. envvar = 'PCS_APPLICATION_SECRET="XXXXXXXXXXXXXXXXXXX")', cmd = 'export PCS_APPLICATION_SECRET "XXXXXXXXXXXXXXXXXXX"', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
/bin/sh: 1: export: https://portal.azure.com/#@XXXXXXXXXXXXXXXXXXX/resource/subscriptions/XXXXXXXXXXXXXXXXXXX/resourceGroups/iot-test/providers/Microsoft.Web/connections/office365-connector/edit: bad variable name
Failed to set environment variable. envvar = 'PCS_OFFICE365_CONNECTION_URL="https://portal.azure.com/#@XXXXXXXXXXXXXXXXXXX/resource/subscriptions/XXXXXXXXXXXXXXXXXXX/resourceGroups/iot-test/providers/Microsoft.Web/connections/office365-connector/edit")', cmd = 'export PCS_OFFICE365_CONNECTION_URL "https://portal.azure.com/#@XXXXXXXXXXXXXXXXXXX/resource/subscriptions/XXXXXXXXXXXXXXXXXXX/resourceGroups/iot-test/providers/Microsoft.Web/connections/office365-connector/edit"', error = '/bin/sh: 1: export: https://portal.azure.com/#@XXXXXXXXXXXXXXXXXXX/resource/subscriptions/XXXXXXXXXXXXXXXXXXX/resourceGroups/iot-test/providers/Microsoft.Web/connections/office365-connector/edit: bad variable name
'
/bin/sh: 1: export: https://prod-04.northeurope.logic.azure.com:443/workflows/XXXXXXXXXXXXXXXXXXX/triggers/manual/paths/invoke?api-version: bad variable name
Failed to set environment variable. envvar = 'PCS_LOGICAPP_ENDPOINT_URL="https://prod-04.northeurope.logic.azure.com:443/workflows/XXXXXXXXXXXXXXXXXXX/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=XXXXXXXXXXXXXXXXXXX")', cmd = 'export PCS_LOGICAPP_ENDPOINT_URL "https://prod-04.northeurope.logic.azure.com:443/workflows/XXXXXXXXXXXXXXXXXXX/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=XXXXXXXXXXXXXXXXXXX"', error = '/bin/sh: 1: export: https://prod-04.northeurope.logic.azure.com:443/workflows/XXXXXXXXXXXXXXXXXXX/triggers/manual/paths/invoke?api-version: bad variable name
'
/bin/sh: 1: export: https://management.azure.com/: bad variable name
Failed to set environment variable. envvar = 'PCS_ARM_ENDPOINT_URL="https://management.azure.com/")', cmd = 'export PCS_ARM_ENDPOINT_URL "https://management.azure.com/"', error = '/bin/sh: 1: export: https://management.azure.com/: bad variable name
'
/bin/sh: 1: export: https://login.microsoftonline.com/: bad variable name
Failed to set environment variable. envvar = 'PCS_AAD_ENDPOINT_URL="https://login.microsoftonline.com/")', cmd = 'export PCS_AAD_ENDPOINT_URL "https://login.microsoftonline.com/"', error = '/bin/sh: 1: export: https://login.microsoftonline.com/: bad variable name
'
/bin/sh: 1: export: http://localhost:9004/v1: bad variable name
Failed to set environment variable. envvar = 'PCS_TELEMETRY_WEBSERVICE_URL=http://localhost:9004/v1)', cmd = 'export PCS_TELEMETRY_WEBSERVICE_URL http://localhost:9004/v1', error = '/bin/sh: 1: export: http://localhost:9004/v1: bad variable name
'
/bin/sh: 1: export: http://localhost:9005/v1: bad variable name
Failed to set environment variable. envvar = 'PCS_CONFIG_WEBSERVICE_URL=http://localhost:9005/v1)', cmd = 'export PCS_CONFIG_WEBSERVICE_URL http://localhost:9005/v1', error = '/bin/sh: 1: export: http://localhost:9005/v1: bad variable name
'
/bin/sh: 1: export: http://localhost:9002/v1: bad variable name
Failed to set environment variable. envvar = 'PCS_IOTHUBMANAGER_WEBSERVICE_URL=http://localhost:9002/v1)', cmd = 'export PCS_IOTHUBMANAGER_WEBSERVICE_URL http://localhost:9002/v1', error = '/bin/sh: 1: export: http://localhost:9002/v1: bad variable name
'
/bin/sh: 1: export: http://localhost:9022/v1: bad variable name
Failed to set environment variable. envvar = 'PCS_STORAGEADAPTER_WEBSERVICE_URL=http://localhost:9022/v1)', cmd = 'export PCS_STORAGEADAPTER_WEBSERVICE_URL http://localhost:9022/v1', error = '/bin/sh: 1: export: http://localhost:9022/v1: bad variable name
'
/bin/sh: 1: export: http://localhost:9001/v1: bad variable name
Failed to set environment variable. envvar = 'PCS_AUTH_WEBSERVICE_URL=http://localhost:9001/v1)', cmd = 'export PCS_AUTH_WEBSERVICE_URL http://localhost:9001/v1', error = '/bin/sh: 1: export: http://localhost:9001/v1: bad variable name
'
/bin/sh: 1: export: http://localhost:9003/v1: bad variable name
Failed to set environment variable. envvar = 'PCS_DEVICESIMULATION_WEBSERVICE_URL=http://localhost:9003/v1)', cmd = 'export PCS_DEVICESIMULATION_WEBSERVICE_URL http://localhost:9003/v1', error = '/bin/sh: 1: export: http://localhost:9003/v1: bad variable name
'
/bin/sh: 1: export: iot-test: bad variable name
Failed to set environment variable. envvar = 'PCS_RESOURCE_GROUP=iot-test)', cmd = 'export PCS_RESOURCE_GROUP iot-test', error = '/bin/sh: 1: export: iot-test: bad variable name
'
/bin/sh: 1: export: iothub-xmkog: bad variable name
Failed to set environment variable. envvar = 'PCS_IOHUB_NAME=iothub-xmkog)', cmd = 'export PCS_IOHUB_NAME iothub-xmkog', error = '/bin/sh: 1: export: iothub-xmkog: bad variable name
'
/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
Failed to set environment variable. envvar = 'PCS_WEBUI_AUTH_AAD_APPID=XXXXXXXXXXXXXXXXXXX)', cmd = 'export PCS_WEBUI_AUTH_AAD_APPID XXXXXXXXXXXXXXXXXXX', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
Failed to set environment variable. envvar = 'PCS_WEBUI_AUTH_AAD_TENANT=XXXXXXXXXXXXXXXXXXX)', cmd = 'export PCS_WEBUI_AUTH_AAD_TENANT XXXXXXXXXXXXXXXXXXX', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
/bin/sh: 1: export:XXXXXXXXXXXXXXXXXXX: bad variable name
Failed to set environment variable. envvar = 'PCS_AAD_CLIENT_SP_ID=XXXXXXXXXXXXXXXXXXX)', cmd = 'export PCS_AAD_CLIENT_SP_ID XXXXXXXXXXXXXXXXXXX', error = '/bin/sh: 1: export: XXXXXXXXXXXXXXXXXXX: bad variable name
'
Environment variables are saved into file: '/home/roche/.pcs/iot-test.env' and sourced for local development.

When I try to check the /home/<user>/.pcs/iot-test.env file I see some variables like:

export PCS_IOTHUBREACT_ACCESS_CONNSTRING "HostName=iothub-xmkog.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=XXXXXXXXXXXXXXXXXXX="
export PCS_IOTHUB_CONNSTRING "HostName=iothub-xmkog.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=XXXXXXXXXXXXXXXXXXX="
export PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING "AccountEndpoint=https://documentdb-xmkog.documents.azure.com:443/;AccountKey=XXXXXXXXXXXXXXXXXXX==;"
export PCS_TELEMETRY_DOCUMENTDB_CONNSTRING "AccountEndpoint=https://documentdb-xmkog.documents.azure.com:443/;AccountKey=XXXXXXXXXXXXXXXXXXX==;"
export PCS_TELEMETRYAGENT_DOCUMENTDB_CONNSTRING "AccountEndpoint=https://documentdb-xmkog.documents.azure.com:443/;AccountKey=XXXXXXXXXXXXXXXXXXX==;"

What makes me thing the variable values are not well defined.

Steps to reproduce

Steps to reproduce:

$ npm install
$ npm start
$ npm link
$ pcs -t remotemonitoring -s local

Expected behavior

All the variables in place to run the services locally with:

docker-compose up

Current behavior

Several variables are not well defined.

Known workarounds

None

Possible solution

Unknown

Context and Environment

Dolphinsimon commented 5 years ago

Did you have the 'local-static-map.json' file in /azure-iot-pcs-remote-monitoring-dotnet/pcs-cli/publish/solutions/remotemonitoring/armtemplates/ ? I have got an error after the application registered. #490

sushilraje commented 5 years ago

This was an error in the CLI and was fixed some time back. @albertinisg What version of cli are you using?

albertinisg commented 5 years ago

I was using branch: d25a741ae6f74aafa50c69962bd469fba046fb65, and within this commit I see the following version: https://github.com/Azure/pcs-cli/tree/DS-2.0.4

jillcary commented 5 years ago

@albertinisg the DS- prefix tags are now primarily used for updates for the Device Simulation solution. For the latest from Remote Monitoring you can use the following tag: https://github.com/Azure/pcs-cli/tree/3.0.1

albertinisg commented 3 years ago

Closing due to inactivity