trailofbits / algo

Set up a personal VPN in the cloud
https://blog.trailofbits.com/2016/12/12/meet-algo-the-vpn-that-works/
GNU Affero General Public License v3.0
28.93k stars 2.32k forks source link

Failed at creating virtual network step when deploying to Azure #754

Closed tyowen closed 6 years ago

tyowen commented 6 years ago

OS / Environment

Ubuntu 16.04 LTS

Ansible version

2.2

Version of components from requirements.txt

Name: msrestazure Version: 0.4.19 Summary: AutoRest swagger generator Python client runtime. Azure-specific module. Home-page: https://github.com/Azure/msrestazure-for-python Author: Microsoft Corporation Author-email: azpysdkhelp@microsoft.com License: MIT License Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires: keyring, msrest, adal

Name: setuptools Version: 38.2.4 Summary: Easily download, build, install, upgrade, and uninstall Python packages Home-page: https://github.com/pypa/setuptools Author: Python Packaging Authority Author-email: distutils-sig@python.org License: UNKNOWN Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires:

Name: ansible Version: 2.2.0.0 Summary: Radically simple IT automation Home-page: http://ansible.com/ Author: Ansible, Inc. Author-email: info@ansible.com License: GPLv3 Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires: PyYAML, setuptools, jinja2, paramiko, pycrypto

Name: dopy Version: 0.3.5 Summary: Python client for the Digital Ocean API Home-page: https://github.com/devo-ps/dopy Author: Vincent Viallet Author-email: vincent@devo.ps License: The MIT License (MIT) Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires: requests

Name: boto Version: 2.48.0 Summary: Amazon Web Services Library Home-page: https://github.com/boto/boto/ Author: Mitch Garnaat Author-email: mitch@garnaat.com License: MIT Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires:

Name: boto3 Version: 1.5.0 Summary: The AWS SDK for Python Home-page: https://github.com/boto/boto3 Author: Amazon Web Services Author-email: UNKNOWN License: Apache License 2.0 Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires: botocore, jmespath, s3transfer

Name: azure Version: 2.0.0rc5 Summary: Microsoft Azure Client Libraries for Python Home-page: https://github.com/Azure/azure-sdk-for-python Author: Microsoft Corporation Author-email: ptvshelp@microsoft.com License: MIT License Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires: azure-batch, azure-servicemanagement-legacy, azure-graphrbac, azure-storage, azure-mgmt, azure-servicebus

Name: msrest Version: 0.4.1 Summary: AutoRest swagger generator Python client runtime. Home-page: https://github.com/xingwu1/autorest/tree/python/ClientRuntimes/Python/msrest Author: Microsoft Corporation Author-email: UNKNOWN License: MIT License Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires: requests, certifi, chardet, requests-oauthlib, keyring, enum34, isodate

Name: apache-libcloud Version: 2.2.1 Summary: A standard Python library that abstracts away differences among multiple cloud provider APIs. For more information and documentation, please see http://libcloud.apache.org Home-page: http://libcloud.apache.org/ Author: Apache Software Foundation Author-email: dev@libcloud.apache.org License: Apache License (2.0) Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires: requests

Name: six Version: 1.11.0 Summary: Python 2 and 3 compatibility utilities Home-page: http://pypi.python.org/pypi/six/ Author: Benjamin Peterson Author-email: benjamin@python.org License: MIT Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires:

Name: pyOpenSSL Version: 17.5.0 Summary: Python wrapper module around the OpenSSL library Home-page: https://pyopenssl.org/ Author: Hynek Schlawack Author-email: hs@ox.cx License: Apache License, Version 2.0 Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires: six, cryptography

Name: Jinja2 Version: 2.8 Summary: A small but fast and easy to use stand-alone template engine written in pure python. Home-page: http://jinja.pocoo.org/ Author: Armin Ronacher Author-email: armin.ronacher@active-4.com License: BSD Location: /mnt/c/Users/ytian/Documents/dev/algo/env/lib/python2.7/site-packages Requires: MarkupSafe

Summary of the problem

Script failed at creating virtual network

Steps to reproduce the behavior

./algo

The way of deployment (cloud or local)

cloud

Expected behavior

Actual behavior

Full log

$ ./algo

What provider would you like to use?

  1. DigitalOcean
  2. Amazon EC2
  3. Microsoft Azure
  4. Google Compute Engine
  5. Install to existing Ubuntu 16.04 server

Enter the number of your desired provider : 3

Enter your azure secret id (https://github.com/trailofbits/algo/blob/master/docs/cloud-azure.md) You can skip this step if you want to use your defaults credentials from ~/.azure/credentials [pasted values will not be displayed] [...]:

Enter your azure tenant id (https://github.com/trailofbits/algo/blob/master/docs/cloud-azure.md) You can skip this step if you want to use your defaults credentials from ~/.azure/credentials [pasted values will not be displayed] [...]:

Enter your azure client id (application id) (https://github.com/trailofbits/algo/blob/master/docs/cloud-azure.md) You can skip this step if you want to use your defaults credentials from ~/.azure/credentials [pasted values will not be displayed] [...]:

Enter your azure subscription id (https://github.com/trailofbits/algo/blob/master/docs/cloud-azure.md) You can skip this step if you want to use your defaults credentials from ~/.azure/credentials [pasted values will not be displayed] [...]:

Name the vpn server: [algo]:

What region should the server be located in? (https://azure.microsoft.com/en-us/regions/)

  1. South Central US
  2. Central US
  3. North Europe
  4. West Europe
  5. Southeast Asia
  6. Japan West
  7. Japan East
  8. Australia Southeast
  9. Australia East
  10. Canada Central
  11. West US 2
  12. West Central US
  13. UK South
  14. UK West
  15. West US
  16. Brazil South
  17. Canada East
  18. Central India
  19. East Asia
  20. Germany Central
  21. Germany Northeast
  22. Korea Central
  23. Korea South
  24. North Central US
  25. South India
  26. West India
  27. East US
  28. East US 2

Enter the number of your desired region:

Do you want macOS/iOS clients to enable "VPN On Demand" when connected to cellular networks? [y/N]:

Do you want macOS/iOS clients to enable "VPN On Demand" when connected to Wi-Fi? [y/N]:

Do you want to install a DNS resolver on this VPN server, to block ads while surfing? [y/N]:

Do you want each user to have their own account for SSH tunneling? [y/N]:

Do you want to apply operating system security enhancements on the server? (warning: replaces your sshd_config) [y/N]:

Do you want the VPN to support Windows 10 or Linux Desktop clients? (enables compatible ciphers and key exchange, less secure) [y/N]:

Do you want to retain the CA key? (required to add users in the future, but less secure) [y/N]:

PLAY [Configure the server] ****

TASK [setup] *** ok: [localhost]

TASK [Generate the SSH private key] **** ok: [localhost]

TASK [Generate the SSH public key] ***** ok: [localhost]

TASK [Change mode for the SSH private key] ***** ok: [localhost]

TASK [Ensure the dynamic inventory exists] ***** ok: [localhost]

TASK [cloud-azure : set_fact] ** ok: [localhost]

TASK [cloud-azure : Create a resource group] *** ok: [localhost]

TASK [cloud-azure : Create a virtual network] ** fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "One-time registration of Microsoft.Network failed - 400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/xxxxxxxxxxx/providers/Microsoft.Network/register?api-version=2016-02-01"}

TASK [cloud-azure : debug] ***** ok: [localhost] => { "fail_hint": [ "Sorry, but something went wrong!", "Please check the troubleshooting guide.", "https://trailofbits.github.io/algo/troubleshooting.html" ] }

TASK [cloud-azure : fail] ** fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed as requested from task"}

PLAY RECAP ***** localhost : ok=8 changed=0 unreachable=0 failed=1

alimakki commented 6 years ago

I've come across a similar issue in a project that I work on. There a bug filed for this in Ansible: https://github.com/ansible/ansible/issues/33657.