Azure / azure-iot-pcs-remote-monitoring-dotnet

Azure IoT .NET solution for Remote Monitoring
MIT License
162 stars 95 forks source link

Failed to disable authentication #169

Closed ritwikgiri closed 3 years ago

ritwikgiri commented 4 years ago

Type of issue

Description

Failed to disable authentication following https://github.com/Azure/azure-iot-pcs-remote-monitoring-dotnet/wiki/Developer-Reference-Guide#disable-authentication. Seems the curl command _keyvault_secret_bundle=$(curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $AUTH_TOKEN" -d "{\"value\": $2}" -L https://$PCS_KEYVAULT_NAME.vault.azure.net/secrets/corsWhitelist/?api-version=7.0) in the /app/auth.sh giving an error like

{"error":{"code":"BadParameter","message":"Property value has invalid value\r\nProperty value has invalid value\r\n"}}

Screenshot

Capture

Steps to reproduce

  1. sudo /app/start.sh --unsafe
  2. POST request using postman https://xxxxxxx.azurewebsites.net/telemetry/v1/alarms

Expected behavior

Current behavior

Known workarounds

Possible solution

Need to fix /app/auth.sh.

Context and Environment

csotomon commented 4 years ago

I am having the same issue here, @ritwikgiri did you solved it?

ritwikgiri commented 4 years ago

I am having the same issue here, @ritwikgiri did you solved it?

No still not resolved..

csotomon commented 4 years ago

I found a problem with the script. in set_env_vars function, when is calling the _set_keyvault_secret, the second parameter must start and finish with a " becouse this parameter is used as a value in a JSON parameter

set_env_vars() {
    # parse through all variables (Every odd variable is env var name & even variables are secret key names in Key vault).
    if [ "$1" == "enable" ]; then
        _set_keyvault_secret "true" "\"\""
    else
        _set_keyvault_secret "false" "\"{ 'origins': ['*'], 'methods': ['*'], 'headers': ['*'] }\""
    fi
}

But this doesn't fix the problem.i think that the problem is the CORS instruction, but i don't where this is used to check it.

gdinatale91 commented 4 years ago

Submitted what I think is the same issue on the dotnet microservices repo https://github.com/Azure/remote-monitoring-services-dotnet/issues/250 but got no response. Tried playing around with the start.sh script but didn't manage to fix this.

miwolfms commented 3 years ago

Note: As of December 10th 2020, Remote Monitoring solution accelerator is no longer supported. All supporting repositories have been archived.