Skip to main content

AD_4nXfvicykLaDx5ay6D8Hf9aiSKHeRoKcsQUntvWwTpXrfqnxF1FBEwbnvL-7YZA6iTAmRfv-Z5LMZYb8B-vcCFhdow7AJTMuZ13lC0O9CaDKgZ3vXzBbxSBoDbz8yW9v534snuzaM?key=EK3FyD2I5ea2Dtvl712Wpw

Netskope Global Technical Success (GTS)

Using AZURE CLI with Netskope: Handling SSL Certificate Errors in Windows 11 with AZURE CLI
 

Netskope Cloud Version - 126


 

Objective

Provide the necessary steps to resolve the SSL error when using AZURE CLI on Windows 11 with the Netskope client enabled.

 

Prerequisite

Use AZURE CLI through CMD on Windows 11. NGSWG must be enabled as part of the licensing. Netskope Client should be enabled.

 

Context

SSL certificate errors occur when running AZURE CLI commands with the Netskope agent active.

Configuration

With the Netskope client enabled, certificate errors occur when using AZURE CLI with certain commands, as shown below:

AD_4nXdFm7VRcPp18nPhSPp8_gvjXBYZoQ_ugNpI56mgpgS3hfY60XzBys0IA-OG4pWmt0UlzDU6DL1yRYJ6oTEVqfkDq-DIr78djTvSHBxMvJELxZ3fci-lRiYDIyYYRrijVjqQIfjpuA?key=EK3FyD2I5ea2Dtvl712Wpw

AD_4nXchAiQsJUK9bbzOgHLT03g2Ger77HeVuPbYbuijZQCv3_9iBXusLvRZDpJ2sGAk-muqaelPDqM3ROAP92xFv3xzidc2mBs0IF7IiU5tC4UQvoXAiWpMEYek5YBBkEAgvAw2jK_n?key=EK3FyD2I5ea2Dtvl712Wpw

If the agent is disabled, the errors disappear and the tool works correctly. The process is based on the Netskope documentation article: 

https://docs.netskope.com/en/configuring-cli-based-tools-and-development-frameworks-to-work-with-netskope-ssl-interception/

To avoid issues with this configuration, please temporarily disable the Netskope Client’s resource protection feature (“Protect Client configuration and resources”) by following the recommendations here: https://docs.netskope.com/en/netskope-client-configuration/ (refer to the “Tamperproof – Protect Client configuration and resources” section). You can re-enable this setting once the configuration process is completed.

The first step is to open a text editor that allows you to create a new .PEM file. In this file, you will combine the certificate from the following path:

C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pem (for 64-bit Windows), and the Netskope certificate.

It’s important to review Microsoft’s article: https://learn.microsoft.com/en-us/cli/azure/use-azure-cli-successfully-troubleshooting?view=azure-cli-latest#work-behind-a-proxy to check the correct certificate path for 32-bit Windows, other distributions, and operating systems.

Essentially, copy the full contents of the Azure certificate file mentioned above into your new .pem file, and then append the contents of the Netskope certificate located at:

%ProgramData%\Netskope\STAgent\data\nscacert.pem

The final combined certificate should start with the Azure certificate content, and end with the Netskope certificate content.

The beginning of the file is an exact copy of the Azure certificate. 

AD_4nXdAxDiQId_o-BX2VwsCxL32mtpLgDoLfvsJzAcdhONyq-hPtWPqfK5BL2Hh5LazAbJacl51VgkdRfO1vT5BuKw5ym5eTo-ClgnPDYSvGDQYp-tDs7Z2GHfn3x-XHYfiLg7usfup?key=EK3FyD2I5ea2Dtvl712Wpw

The end of the file will be the addition of the Netskope certificate, as shown in the image.

AD_4nXetwmbWAeWo6WOzaHZD_QZXTSjwf4IfnzZPOW0teGyZ1N1AIQ-IEg_a3djsPB9UhmpNF7hs23-5bbqg6NF7fUO4A638kZiPv9WJCE6DG8bQ1sBAKZlVWAnj_vf0S8etB_Rt2KG3gg?key=EK3FyD2I5ea2Dtvl712Wpw

Then make sure to save this file in the .PEM format. It can be saved in the following path:

C:\ProgramData\netskope\stagent - or in a path of your preference.

AD_4nXf9O651nWlrYwMFe-YOu9QpJxg2EMqe6rV9jtrI0TG1RZ04irxPW5WOXrm1304ieHAnntlqwktSN2vXW0UsbOgNQjvVAnf4ZBp_YEvNjpiPmu6KtKLTvhmsc5yociCR-wOEnYi2?key=EK3FyD2I5ea2Dtvl712Wpw

After that, you need to set the REQUESTS_CA_BUNDLE environment variable globally to point to the new certificate. Open a CMD window as administrator and run the following command:

  • setx REQUESTS_CA_BUNDLE "C:\ProgramData\netskope\stagent\nscacert_combined.pem" /M

AD_4nXes3gTBx0ccBfv6-uw9VVU_vaS0jCtBg1Gn6ztoSevEPuFegGHomymqug9PMq2mutUeFnn3X6L--V6RIpxH3Qxm57oQXLPhUYqulGZVkmzYi0DjLb_xKRASlxmD1QhsMluwEfOQ?key=EK3FyD2I5ea2Dtvl712Wpw

Close this CMD window and open a new one as administrator as well. Make sure that the Netskope agent is enabled and the configuration is up to date. After this, you should be able to run Azure CLI commands in the CMD without encountering certificate issues.

AD_4nXcW6TjG_W02nyY7oRBMe3fSILPebxLjW30MGEw5FCf38JMiUO7KKER6KEzuqaLk0YODgTuy2EJ1_mtbB43c8ls1loeyX2OMXqAc1Ycju_9mIh-p7xPlrZW3Hq-HZcUbJX9FNnc9mw?key=EK3FyD2I5ea2Dtvl712Wpw

Important:

This configuration should persist across AZURE CLI version changes since it sets a Windows environment variable. It’s important to note that the combined .pem certificate must not be moved or modified—doing so would cause the variable to point to an invalid location, resulting in certificate errors again. As of the time of execution, Azure CLI version 2.74.0 is being used. This behavior will be confirmed again as soon as a new version is released.

AD_4nXeoZjhDLlcYzITgkVoBGkzj7QnK5RdutXiSijFHvixmJcX3eSRx153MPB6DnvZliALre2Tc2M3AvhX8BJebeYyH3vdK6zjpVLkZyFkCy6207lMi_-GsYsBRCVD9W1Fp4Y9ljyDSpQ?key=EK3FyD2I5ea2Dtvl712Wpw

 

Terms and Conditions

  • All documented information undergoes testing and verification to ensure accuracy.
  • In the future, it is possible that the application's functionality may be altered by the vendor. If any such changes are brought to our attention, we will promptly update the documentation to reflect them.

Notes

  • This article is authored by Netskope Global Technical Success (GTS).
  • For any further inquiries related to this article, please contact Netskope GTS by submitting a support case with 'Case Type – How To Questions'.

 

Be the first to reply!