Skip to content

cloudacademy/azure-vcf-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

azure-vcf-env

Environment for working with Azure VCFs

Getting started

  1. Ensure Python 3.8+ is installed on your system

  2. Create an Azure Active Directory application (or request on be created)

  3. Create a secret for the application

  4. Create a resource group

  5. Assign the application to the Contributor or Reader role on the resource group (Request permission if you are not authorized to assign roles on the resource group)

  6. In .vscode/launch.json fill in the AZURE_CLIENT_ID and AZURE_CLIENT_SECRET for the VCF user. Be sure to escape the JSON. Avoid using online tools to do this due to the sensitive nature of what you are escaping. The resulting env map will resemble:

    {
        "AZURE_SUBSCRIPTION_ID": "12345678-1234-1234-1234-123456789012",
        "AZURE_CLIENT_ID": "abcdefab-abcd-abcd-abcd-abcdefabcdef",
        "AZURE_CLIENT_SECRET": "AL8)RxYQzCf./dF!y5EN13eqdg3T!qwh",
        "AZURE_TENANT_ID": "1234abcd-1234-1234-1234-1234abcd1234",
        "AZURE_RESOURCE_GROUP": "your-resource-group"
    }
  7. In init.sh (Mac/Linux)/init.ps1 (Windows) replace YOUR_BITBUCKET_USER with the name of your Cloud Academy BitBucket user

  8. Run init.sh (Mac/Linux)/init.ps1 (Windows) to set up the environment

    • Enter your Cloud Academy BitBucket password/app password when prompted.
  9. Add the following line to .gitignore to avoid committing any sensitive information:

    .vscode/
    
  10. Develop and debug functions using the Current File (Integrated Terminal) configuration (press F5 with the file open)

Update Dependencies

  1. Run init.sh (Mac/Linux)/init.ps1 (Windows) to set up the virtual environment again. (only the venv/ directory is impacted by this operation)

Adding Dependencies

  1. Add the package including version to the requirements.txt file

  2. Run the following to remove the existing virtual environment and install only the production dependencies in a clean environment:

    rm -rf venv # clean start
    python3 -m venv venv
    source ./venv/bin/activate
    pip install -r requirements.txt # prod dependencies
  3. Freeze the prod dependencies into requirements.txt:

    pip freeze > requirements.txt
  4. Add in the dev dependencies

    pip install pylint autopep8 # dev dependencies
  5. Run the code below the # Trim Azure mgmt packages included api versions comment in init.sh to trim the API versions of the Azure management clients to reduce the disk space (lambda layers have only ~256MB available).

  6. Test your check functions are working after trimming and create a pull request on bitbucket labs-vcf-boilerplates with the new requirements.txt

References