You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/emulator.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Every request made against the emulator must be authenticated using a key over T
51
51
52
52
## Import emulator certificate
53
53
54
-
In some cases, you may wish to manually import the TLS/SS certificate from the emulator's running container into your host machine. This step avoids bad practices like disabling TLS/SSL validation in the SDK. For more information, see [import certificate](how-to-develop-emulator.md#export-the-emulators-tlsssl-certificate).
54
+
In some cases, you may wish to manually import the TLS/SS certificate from the emulator's running container into your host machine. This step avoids bad practices like disabling TLS/SSL validation in the SDK. For more information, see [import certificate](how-to-develop-emulator.md#import-the-emulators-tlsssl-certificate).
Copy file name to clipboardExpand all lines: articles/cosmos-db/how-to-develop-emulator.md
+60-11Lines changed: 60 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -351,9 +351,9 @@ The Docker (Windows) container image doesn't support the API for MongoDB.
351
351
352
352
::: zone-end
353
353
354
-
## Export the emulator's TLS/SSL certificate
354
+
## Import the emulator's TLS/SSL certificate
355
355
356
-
Export the certificate for the emulator to use the emulator with your preferred developer SDK without disable TLS/SSL on the client.
356
+
Import the emulator's TLS/SSL certificate to use the emulator with your preferred developer SDK without disabling TLS/SSL on the client.
357
357
358
358
::: zone pivot="api-apache-cassandra,api-apache-gremlin,api-table"
359
359
@@ -371,7 +371,7 @@ The Windows local installation of the emulator automatically imports the TLS/SSL
371
371
372
372
### [Docker (Linux container)](#tab/docker-linux)
373
373
374
-
The certificate for the emulator is available in the `_explorer/emulator.pem` path on the running container. Use `curl` to download the certificate from the running container to your local machine.
374
+
The certificate for the emulator is available at the path `_explorer/emulator.pem` on the running container. Use `curl` to download the certificate from the running container to your local machine.
1. Update CA certificates and regenerate the certificate bundle by using the appropriate command for your Linux distribution.
411
+
412
+
For **Debian-based** systems (e.g., Ubuntu), use:
413
+
414
+
```bash
415
+
sudo update-ca-certificates
416
+
```
417
+
418
+
For **Red Hat-based** systems (e.g., CentOS, Fedora), use:
419
+
```bash
420
+
sudo update-ca-trust
421
+
```
422
+
423
+
For more detailed instructions, consult the documentation specific to your Linux distribution.
410
424
411
425
### [Windows (local)](#tab/windows)
412
426
@@ -418,7 +432,7 @@ The Windows local installation of the emulator automatically imports the TLS/SSL
418
432
419
433
## Connect to the emulator from the SDK
420
434
421
-
Each SDK includes a client class typically used to connect the SDK to your Azure Cosmos DB account. Using the [emulator's credentials](emulator.md#authentication), you can connect the SDK to the emulator instance instead.
435
+
Each SDK includes a client class typically used to connect the SDK to your Azure Cosmos DB account. By using the [emulator's credentials](emulator.md#authentication), you can connect the SDK to the emulator instance instead.
422
436
423
437
::: zone pivot="api-nosql"
424
438
@@ -467,7 +481,7 @@ Use the [Azure Cosmos DB API for NoSQL .NET SDK](nosql/quickstart-dotnet.md) to
467
481
```
468
482
469
483
> [!WARNING]
470
-
> If you get a SSL error, you may need to disable TLS/SSL foryour application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulatorin a container, and have not [imported the container's SSL certificate](#export-the-emulators-tlsssl-certificate). To resolve this, configure the client's options to disable TLS/SSL validation before creating the client:
484
+
> If you get a SSL error, you may need to disable TLS/SSL for your application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulator in a container, and have not [imported the container's SSL certificate](#import-the-emulators-tlsssl-certificate). To resolve this, configure the client's options to disable TLS/SSL validation before creating the client:
471
485
>
472
486
>```csharp
473
487
> CosmosClientOptions options = new ()
@@ -527,7 +541,7 @@ Use the [Azure Cosmos DB API for NoSQL Python SDK](nosql/quickstart-python.md) t
527
541
```
528
542
529
543
> [!WARNING]
530
-
> If you get a SSL error, you may need to disable TLS/SSL for your application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulator in a container, and have not [imported the container's SSL certificate](#export-the-emulators-tlsssl-certificate). To resolve this, configure the application to disable TLS/SSL validation before creating the client:
544
+
> If you get a SSL error, you may need to disable TLS/SSL for your application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulator in a container, and have not [imported the container's SSL certificate](#import-the-emulators-tlsssl-certificate). To resolve this, configure the application to disable TLS/SSL validation before creating the client:
531
545
>
532
546
>```python
533
547
> import urllib3
@@ -536,6 +550,41 @@ Use the [Azure Cosmos DB API for NoSQL Python SDK](nosql/quickstart-python.md) t
536
550
>```
537
551
>
538
552
553
+
If you are still facing SSL errors, it is possible that Python is retrieving the certificates from a different certificate store. To determine the path where Python is looking for the certificates, follow these steps:
554
+
>[!IMPORTANT]
555
+
>If you are using a Python **virtual environment** (venv) ensure it is **activated** before running the commands!
556
+
1. Open a terminal
557
+
1. Start the Python interpreter by typing python or python3, depending on your Python version.
558
+
1. In the Python interpreter, run the following commands:
559
+
```python
560
+
from requests.utils import DEFAULT_CA_BUNDLE_PATH
561
+
print(DEFAULT_CA_BUNDLE_PATH)
562
+
```
563
+
564
+
**Inside a virtual environment**, the path may be (at least in Ubuntu):
**Outside of a virtual environment**, the path may be (at least in Ubuntu):
570
+
```bash
571
+
/etc/ssl/certs/ca-certificates.crt
572
+
```
573
+
574
+
1. Once you have identified the DEFAULT_CA_BUNDLE_PATH, open a **new terminal** and run the following commands to append the emulator certificate to the certificate bundle:
575
+
> [!IMPORTANT]
576
+
> If DEFAULT_CA_BUNDLE_PATH variable points to a **system directory**, you might encounter a **"Permission denied"** error. In this case, you will need to run the commands with elevated privileges (as root). Also, you will need to [update and regenerate the certificate bundle](#import-the-emulators-tlsssl-certificate) after executing the provided commands.
577
+
578
+
```bash
579
+
# Add a new line to the certificate bundle
580
+
echo>> /path/to/ca_bundle
581
+
```
582
+
583
+
```bash
584
+
# Append the emulator certificate to the certificate bundle
Use the [Azure Cosmos DB API for NoSQL Node.js SDK](nosql/quickstart-nodejs.md) to connect to the emulator from a Node.js/JavaScript application.
@@ -579,7 +628,7 @@ Use the [Azure Cosmos DB API for NoSQL Node.js SDK](nosql/quickstart-nodejs.md)
579
628
```
580
629
581
630
> [!WARNING]
582
-
> If you get a SSL error, you may need to disable TLS/SSL for your application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulator in a container, and have not [imported the container's SSL certificate](#export-the-emulators-tlsssl-certificate). To resolve this, configure the application to disable TLS/SSL validation before creating the client:
631
+
> If you get a SSL error, you may need to disable TLS/SSL for your application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulator in a container, and have not [imported the container's SSL certificate](#import-the-emulators-tlsssl-certificate). To resolve this, configure the application to disable TLS/SSL validation before creating the client:
583
632
>
584
633
>```javascript
585
634
> process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
@@ -715,7 +764,7 @@ Use the [MongoDB Node.js driver](mongodb/quickstart-nodejs.md) to connect to the
715
764
```
716
765
717
766
> [!WARNING]
718
-
> If you get a SSL error, you may need to disable TLS/SSL for your application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulator in a container, and have not [imported the container's SSL certificate](#export-the-emulators-tlsssl-certificate). To resolve this, configure the application to disable TLS/SSL validation before creating the client:
767
+
> If you get a SSL error, you may need to disable TLS/SSL for your application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulator in a container, and have not [imported the container's SSL certificate](#import-the-emulators-tlsssl-certificate). To resolve this, configure the application to disable TLS/SSL validation before creating the client:
719
768
>
720
769
>```javascript
721
770
> const client = new MongoClient(
@@ -858,7 +907,7 @@ Use the [Apache Cassandra Node.js driver](cassandra/manage-data-nodejs.md) to us
858
907
```
859
908
860
909
> [!WARNING]
861
-
> If you get a SSL error, you may need to disable TLS/SSL foryour application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulatorin a container, and have not [imported the container's SSL certificate](#export-the-emulators-tlsssl-certificate). To resolve this, configure the client to disable TLS/SSL validation:
910
+
> If you get a SSL error, you may need to disable TLS/SSL foryour application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulatorin a container, and have not [imported the container's SSL certificate](#import-the-emulators-tlsssl-certificate). To resolve this, configure the client to disable TLS/SSL validation:
862
911
>
863
912
> ```javascript
864
913
> const client = new Client({
@@ -1136,7 +1185,7 @@ Use the [Azure Tables JavaScript SDK](cassandra/manage-data-nodejs.md) to use th
1136
1185
```
1137
1186
1138
1187
> [!WARNING]
1139
-
> If you get a SSL error, you may need to disable TLS/SSL for your application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulator in a container, and have not [imported the container's SSL certificate](#export-the-emulators-tlsssl-certificate). To resolve this, configure the client to disable TLS/SSL validation:
1188
+
> If you get a SSL error, you may need to disable TLS/SSL for your application. This commonly occurs if you are developing on your local machine, using the Azure Cosmos DB emulator in a container, and have not [imported the container's SSL certificate](#import-the-emulators-tlsssl-certificate). To resolve this, configure the client to disable TLS/SSL validation:
0 commit comments