Can I change a value in sonar.properties via API?

Hello everyone,

I need to know if is posibly to change sonar.properties file via API, because im using Sonarqube with Keycloak and protocol SAML, so I need to change cert or other parameters when I will need it and made manual with multi sonar server is so tedious, es better with automation and one idea is using API

I loooking fro in doc but I dont see nothing about that
https://docs.sonarqube.org/display/DEV/Web+API

Regards

Check out the Web API documentation linked in the footer of your instance (hint: api/settings!)

1 Like

Hello @Colin,

Ty for reply, I am wachting api and see values of SAML plugins in sonar.properties are read-only? So if hace value I cant change then ? How about this discription: api-setting-set

The only way is that values are blank? :frowning:

Regards

@Jonathan_Velasco At least for SonarSource’s [SAML Authentication Plugin|https://docs.sonarqube.org/display/PLUG/SAML+Authentication+Plugin], those related settings are set through the UI (thus also able to be manipulated with the Web API). They aren’t set in a sonar.properties file. I can’t speak for other plugins.

1 Like

Hi,

Colin answered the question in the body of the OP. For the sake of posterity, I’d like to answer the question in the title.

No, you cannot reset, override, &etc values set in sonar.properties via the UI / web services. Conversely, you cannot set in sonar.properties values that are set via the UI / web services.

…and never the twain shall meet.

 
Ann

1 Like

Hello @ganncamp ,

I have one more question, but is posible set values if the key of properties is empty?

For example, I want set this keys of plugin SAML in sonar.properties

sonar.auth.saml.enabled= (to true)
sonar.auth.saml.certificate.secured= (cert here)

Is posible with API set this values?

Regards

Hi,

Yes, it should be. Look at /api/settings/set.

 
Ann