Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add devcontainer and Azure CLI script #101

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

pamelafox
Copy link
Contributor

The original goal of this pull request was to add a Dev Container configuration, but I realized it was easier to rewrite the scripts using the Azure CLI than get Powershell working inside a Dev Container on my Mac.

So, this PR does two things:

  1. Adds a dev container config that creates a Python environment with the azure-cli installed in it
  2. Replaces the Powershell scripts with bash scripts that use the Azure CLI scripts. It's possible the scripts don't have every capability of the original Powershell scripts, but they definitely take care of the steps from https://learn.microsoft.com/en-us/azure/active-directory/develop/web-app-quickstart?pivots=devlang-python&tabs=windows, and it's a pretty pleasant process. Try it out!

Example of using them:

vscode ➜ /workspaces/ms-identity-python-webapp (devcontainer) $ ./scripts/configure.sh
Extension 'account' 0.2.5 is already installed.
Attempting login to Azure...
A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.
The following tenants don't contain accessible subscriptions. Use 'az login --allow-no-subscriptions' to have tenant level access.
2f32b846-1945-4cf2-a2ca-087cf844c482 'PythonPythonPython'
The following tenants require Multi-Factor Authentication (MFA). Use 'az login --tenant TENANT_ID' to explicitly login to a tenant.
12c2c747-3cbe-4a7d-9af6-a151055e24d4 'PythonB2C'
Attempting app registration creation...
Attempting to add a client secret to app 06362acb-91a0-4adc-aad5-a7ea6349dd18 ...
WARNING: The output includes credentials that you must protect. Be sure that you do not include these credentials in your code or check the credentials into your source control. For more information, see https://aka.ms/azadsp-cli
Attempting to grant permissions for app 06362acb-91a0-4adc-aad5-a7ea6349dd18 to Microsoft Graph API User.ReadBasic.All...
Creating .env file...
Writing configuration to .env file...
Configuration complete.
vscode ➜ /workspaces/ms-identity-python-webapp (devcontainer) $ ./scripts/cleanup.sh 
Attempting to delete service principal with ID 02b2153f-6467-438d-ab72-c2390875e39d
Attempting to delete app with ID 06362acb-91a0-4adc-aad5-a7ea6349dd18
All associated resources are cleaned up.

@pamelafox
Copy link
Contributor Author

@rayluo I'm excited about this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant