author | ms.service | ms.topic | ms.date | ms.author |
---|---|---|---|---|
PatrickFarley |
azure-ai-vision |
include |
08/07/2023 |
pafarley |
In this example, write your credentials to environment variables on the local machine that runs the application.
[!INCLUDE find key and endpoint]
Tip
Don't include the key directly in your code, and never post it publicly. See the Azure AI services security article for more authentication options like Azure Key Vault.
To set the environment variable for your key and endpoint, open a console window and follow the instructions for your operating system and development environment.
- To set the
VISION_KEY
environment variable, replaceyour-key
with one of the keys for your resource. - To set the
VISION_ENDPOINT
environment variable, replaceyour-endpoint
with the endpoint for your resource.
setx VISION_KEY <your_key>
setx VISION_ENDPOINT <your_endpoint>
After you add the environment variables, you may need to restart any running programs that will read the environment variables, including the console window.
export VISION_KEY=<your_key>
export VISION_ENDPOINT=<your_endpoint>
After you add the environment variables, run source ~/.bashrc
from your console window to make the changes effective.