#env-var #azure #provisioning #developer #locate #defined #env-file #cli

dotazure

Locate and load environment variables defined when provisioning an Azure Developer CLI project

2 unstable releases

0.2.0 May 8, 2025
0.1.0 May 4, 2025

#2205 in Network programming

Download history 136/week @ 2025-05-01 217/week @ 2025-05-08 27/week @ 2025-05-15

255 downloads per month

MIT license

24KB
446 lines

Dotazure

releases docs ci

Locate and load environment variables defined when provisioning an Azure Developer CLI project.

Getting Started

If you do not already have an Azure Developer CLI (azd) project, you can create one:

azd init

After you define some resources e.g., an Azure Key Vault, you can provision those resources which will create a .env file with any output parameters:

azd up

Example

After azd up provisions resources and creates a .env file, you can call load() to load those environment variables from the default environment e.g.,

fn main() {
    dotazure::load().unwrap();

    // Assumes bicep contains e.g.
    //
    // output AZURE_KEYVAULT_URL string = kv.properties.vaultUri
    println!(
        "AZURE_KEYVAULT_URL={}",
        std::env::var("AZURE_KEYVAULT_URL").unwrap(),
    );
}

If you want to customize behavior, you can call dotazure::loader() to get a builder-like object.

License

Licensed under the MIT license.

Dependencies

~0.7–1.5MB
~33K SLoC