Closed ccrivelli closed 4 years ago
@ccrivelli Are you attempting to use classic azure or azure arm? If you are using azure arm you will have to edit your configs as well?
For reference here are the azure arm getting started docs: https://docs.saltstack.com/en/latest/topics/cloud/azurearm.html
Oh I didn't read that doc page yet @Ch3LL . I will give a try with Azure ARM following the link you sent me and let you know.
Thanks
I've just modified my provider config to load the azurearm driver:
azure:
driver: azurearm
..
But I'm getting this error:
# salt-cloud --list-providers
[WARNING ] Missing dependency: 'azurearm'. The azurearm driver requires 'azurearm' to be installed.
[WARNING ] The cloud driver, 'azurearm', configured under the 'azure' cloud provider alias, could not be loaded. Please check your provider configuration files and ensure all required dependencies are installed for the 'azurearm' driver.
In rare cases, this could indicate the 'azurearm.get_configured_provider()' function could not be found.
Removing 'azurearm' from the available providers list
I installed all the dependencies mentioned in the doc:
Microsoft Azure SDK for Python >= 2.0rc5
azure (2.0.0rc5)
Microsoft Azure Storage SDK for Python >= 0.32
azure-storage (0.32.0)
The python-requests library, for Python < 2.7.9.
requests (2.7.0)
I guess I'm still missing something... What do you think @Ch3LL ?
Thanks
@ccrivelli thanks for trying that. The first step to troubleshooting this: could you try importing the following: https://github.com/saltstack/salt/blob/develop/salt/cloud/clouds/azurearm.py#L77-L112
Those are all of the required dependencies for azurearm. So this will help narrow down if you have the correct dependencies.
You can test these imports by running python -c 'import azure.storage'
for those imports on your salt-cloud box. And if you get an import error on any of those then you are missing that dependency.
@Ch3LL Ok, I found a couple of missing dependecies:
msrest
msrestazure
and - after installing them - I was able to load the azurearm module.
I installed also some other libs to fix pip compilation errors (python-devel, libxml2-devel, libxslt-devel, openssl-devel).
Now I can correctly list my azure provider, but I'm having a problem when creating an Azure vm:
# salt-cloud -p azure-win test-win
[ERROR ] There was a profile error: , InvalidGrantError: (invalid_grant) AADSTS50034: To sign into this application the account must be added to the management.core.windows.net directory.
Trace ID: 8052d818-5108-4985-af86-819c9d82cdec
Correlation ID: cc31607c-fc7d-42e8-864c-c03f26b9dfe7
Timestamp: 2017-01-27 01:46:40Z
I guess this is more related about how to setup an Application with the right permissions to access my Azure Resource Manager via API as I tried both with:
and It doesn't work.
I guess it might be something around the Azure Active Directory, but I'm not sure yet.
What do you think?
Thanks
I found this doc about Azure Api Reference: https://docs.microsoft.com/en-us/rest/api/#create-the-request But I don't get how it can be integrated with salt-cloud yet.
Now, after several tests, I was able to login in this way.. -- provider config
# cat /etc/salt/cloud.providers.d/azure.provider.conf
azure:
driver: azurearm
subscription_id: <my_subrcription_id>
username: <my_personal_username>
password: <my_personal_password>
location: 'West US 2'
resource_group: Salt-RG
# not optional
network_resource_group: Salt-RG
network: Salt-Vnet
~
-- I manually created via Azure Portal
ResourceGroup: Salt-RG
Vnet: Salt-Vnet
Now, when I try to spin up an instance with salt-cloud, I see the client logged in properly, then the Network Interface test-win-iface0
is automatically created (Http Response Code 200), but immediately after it goes in loop forever because The Resource 'Microsoft.Network/publicIPAddresses/test-win-iface0-ip' under resource group 'Salt-RG' was not found.
(Http Response Code 404) and tried again infinitely.
-- these are the debug logs for the Http request/response that's going in loop
# salt-cloud -p azure-win test-win -l debug
..
[DEBUG ] Requesting url https://management.azure.com/subscriptions/<my_sub_id>/resourceGroups/Salt-RG/providers/Microsoft.Network/publicIPAddresses/test-win-iface0-ip?api-version=2016-03-30 using method GET.
[DEBUG ] Supplying headers {'Content-Type': 'application/json; charset=utf-8', 'accept-language': 'en-US', 'x-ms-client-request-id': '...', u'Authorization': u'Bearer
..'
} and data []
[DEBUG ] Passing through key word arguments {'files': None, 'cookies': None, 'stream': True, 'verify': True, 'cert': None, 'timeout': 100, 'allow_redirects': True}.
[DEBUG ] Request URL: 'https://management.azure.com/subscriptions/<my_sub_id>/resourceGroups/Salt-RG/providers/Microsoft.Network/publicIPAddresses/test-win-iface0-ip?api-version=2016-03-30'
[DEBUG ] Request method: 'GET'
[DEBUG ] Request headers:
[DEBUG ] 'accept-language': 'en-US'
[DEBUG ] 'Accept-Encoding': 'gzip, deflate'
[DEBUG ] 'x-ms-client-request-id': '...'
[DEBUG ] 'Accept': 'application/json'
[DEBUG ] 'User-Agent': 'python/2.7.5 (Linux-3.10.0-514.2.2.el7.x86_64-x86_64-with-centos-7.3.1611-Core) requests/2.7.0 msrest/0.4.4 msrest_azure/0.4.7 networkmanagementclient/0.30.0rc5 Azure-SDK-For-Python SaltCloud/2016.11.1'
[DEBUG ] 'Connection': 'keep-alive'
[DEBUG ] 'Content-Type': 'application/json; charset=utf-8'
[DEBUG ] 'Authorization': u'Bearer ..'
[DEBUG ] Request body:
[DEBUG ] None
[DEBUG ] Received status: 404 for method 'GET'
[DEBUG ] Is forced retry: False
[DEBUG ] Response status: 404
[DEBUG ] Response headers:
[DEBUG ] 'content-length': '165'
[DEBUG ] 'expires': '-1'
[DEBUG ] 'x-ms-failure-cause': 'gateway'
[DEBUG ] 'x-ms-request-id': '...'
[DEBUG ] 'strict-transport-security': 'max-age=31536000; includeSubDomains'
[DEBUG ] 'x-ms-correlation-request-id': '...'
[DEBUG ] 'pragma': 'no-cache'
[DEBUG ] 'cache-control': 'no-cache'
[DEBUG ] 'date': 'Tue, 31 Jan 2017 04:29:42 GMT'
[DEBUG ] 'x-ms-routing-request-id': 'EASTUS2:20170131T042942Z:...'
[DEBUG ] 'content-type': 'application/json; charset=utf-8'
[DEBUG ] Response content:
[DEBUG ] {"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Network/publicIPAddresses/test-win-iface0-ip' under resource group 'Salt-RG' was not found."}}
[DEBUG ] The Resource 'Microsoft.Network/publicIPAddresses/test-win-iface0-ip' under resource group 'Salt-RG' was not found.
Any thought?
Thanks
Bump ... same issue
The Resource 'Microsoft.Network/publicIPAddresses/test-win-iface0-ip' under resource group '...' was not found.
Why is it trying to look for public ip ? public ip's are not assigned automatically. I think the implementation is wrong.
@ccrivelli note that image has to be in different format Canonical|UbuntuServer|14.04.5-LTS|14.04.201612050
as per https://docs.saltstack.com/en/latest/topics/cloud/azurearm.html#image
jagguli & ccrivelli - me too facing the same issue - public ip's are not assigned automatically. is there any work around ?
ditto here... salt-cloud is sort of useless on Azure with this bug.
I haven't setup the azure arm personally so I am going to bring in someone else to help out here. ping @techhat can you chime in here?
As a side note I know he added some more docs today here: https://github.com/saltstack/salt/pull/40564/files not sure if they help at all
Seeing the same issue. Lots of quirks in the azurearm module....
Hi SaltStack folks - any update on this one? This bug looks like a showstopper for salt-cloud on Azure (in 2016.11), at least without a public IP.
With public_ip: False
in the cloud profile, the network interface is created but then the provisioning process gets caught in a loop, repeatedly spitting out this error:
[DEBUG ] {"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Network/publicIPAddresses/vmname-iface0-ip' under resource group 'rg_name' was not found."}}
With public_ip: True
in the cloud profile, Salt bootstraps the instance successfully by SSHing to the public IP. However, the minion configuration doesn't seem to respect the "master: " (private IP) setting in my cloud profile - on the bootstrapped minion, /etc/salt/mininon
looks like this:
hash_type: sha256 id: salt-test-minion-4 log_level: info master: salt
I just spoke to @techhat and it looks like you guys are not setting subnet
. Can you try setting the subnet and see if you get different results?
Its documented here
I have a problem to get to work salt-cloud with Azure RM, i tried all but seems something missed or there is a problem with current salt cloud version vs azure rm.
"[WARNING ] Missing dependency: 'azurearm'. The azurearm driver requires 'azurearm' to be installed. [WARNING ] The cloud driver, 'azurearm', configured under the 'my-azure-config' cloud provider alias, could not be loaded. Please check your provider configuration files and ensure all required dependencies are installed for the 'azurearm' driver."
salt --version salt 2016.11.3 (Carbon)
pip freeze |grep azure azure==1.0.3 azure-batch==1.0.0 azure-common==1.1.5 azure-mgmt==0.20.2 azure-mgmt-batch==1.0.0 azure-mgmt-common==0.20.0 azure-mgmt-compute==0.20.1 azure-mgmt-keyvault==0.30.0rc6 azure-mgmt-logic==1.0.0 azure-mgmt-network==0.20.1 azure-mgmt-nspkg==2.0.0 azure-mgmt-redis==1.0.0 azure-mgmt-resource==0.20.1 azure-mgmt-scheduler==1.0.0 azure-mgmt-storage==0.20.0 azure-nspkg==2.0.0 azure-servicebus==0.20.1 azure-servicemanagement-legacy==0.20.2 azure-storage==0.20.3 msrestazure==0.4.7
pip freeze |grep msrest msrest==0.4.6 msrestazure==0.4.7
cat /etc/salt/cloud.providers.d/azure.conf my-azure-config: driver: azurearm
@Ch3LL Just tried setting the subnet; however, the virtual machine is not created and using -l debug shows that Salt is looping around and doesn't find the virtual interface (Salt is supposed to create the virtual interface, though).
update: I was able to replicate this issue. We are currently working on a fix.
Okay we are working on getting #38565 backported to 2016.11 but that should fix the problem. Can anyone here confirm this as well?
Here is the backport/fix: https://github.com/saltstack/salt/pull/41029
@xenuser would you mind trying out the fix in #41029 I did some testing and we can now create the interface but I was running into issues related to my account privileges when attempting to create a VM so any other user confirmation would be great. Thanks
@Ch3LL Thanks for tagging me. When I saw the backport/fix, I decided to spend some time testing it. Will do so within the next 2-48 hours!
My test with the backport/fix:
root@saltstack:~# salt-cloud -p azure-ubuntu newinstance
[WARNING ] There was a cloud error: Azure Error: InvalidParameter
Message: The supplied password must be between 6-72 characters long and must satisfy at least 3 of password complexity requirements from the following:
1) Contains an uppercase character
2) Contains a lowercase character
3) Contains a numeric digit
4) Contains a special character.
Target: adminPassword
[WARNING ] This may or may not indicate an actual problem
[ERROR ] Failed to create VM newinstance. Configuration value 'network_profile' needs to be set
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 1291, in create
output = self.clouds[func](vm_)
File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/azurearm.py", line 1117, in create
'wait_for_ip_interval_multiplier', vm_, __opts__, default=1),
File "/usr/lib/python2.7/dist-packages/salt/utils/cloud.py", line 2376, in wait_for_ip
data = update_callback(*update_args, **update_kwargs)
File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/azurearm.py", line 1093, in _query_ip_address
ifaces = data['network_profile']['network_interfaces']
KeyError: 'network_profile'
Error: There was a profile error: Failed to deploy VM
My azurearm settings:
root@saltstack:/etc/salt/cloud.providers.d# cat azurearm.conf
my-azurearm-config:
driver: azurearm
master: localhost
subscription_id: edited-away
#certificate_path: /etc/salt/azure.pem
username: api@edited-away.com
password: TOPSECRET
location: westeurope
resource_group: topsecret
# Set up the location of the salt master
#
minion:
master: saltstack
virtual_network_name: edited-vnet
subnet_name: azure-subnet
network_resource_group: edited
network: desktop-vnet
cleanup_disks: True
cleanup_vhds: True
cleanup_data_disks: True
cleanup_interfaces: True
custom_data: 'This is a Joseph test'
expire_publisher_cache: 604800 # 1 week
expire_offer_cache: 604800 # 1 week
expire_sku_cache: 604800 # 1 week
expire_version_cache: 604800 # 1 week
expire_group_cache: 86400 # 1 day
expire_interface_cache: 3600 # 1 hour
expire_network_cache: 3600 # 1 hour
expire_subnet_cache: 3600 # 1 hour
A profile:
root@saltstack:/etc/salt# cat cloud.profiles
azure-ubuntu:
provider: my-azurearm-config
image: Canonical|UbuntuServer|14.04.5-LTS|14.04.201612050
size: Standard_D1_v2
location: westeurope
ssh_username: azureuser
ssh_password: topsecret
subnet: default
public_ip: True
storage_account: tests214
network_profile: test-test2-nsg
Thank you so much for testing that so quick! Seriously thank you. We will investigate this right now.
You're welcome. I hope this helps :\ I don't know why the password warning is being shown, my password meets all requirements (never saw this before).
Let me know when I can do some other/further testing.
Okay I dove in and i was able to replicate your issue if hte password from ssh_password
did not follow those requirements. Which then causes data to be empty hence the reason for the keyerror. If you change your password to follow those requirements do you succeed?
Sorry for the late reply. I completely missed that you asked me to test again with a more secure ssh_password.
I just changed it. Now I receive the following message:
CloudError: 404 Client Error: Not Found for url: https://management.azure.com/subscriptions/top-secret-id/providers/Microsoft.Network/locations/westeurope/operations/some-hash?api-version=2017-03-01
I don't know if this is my fault. The account/app/ressource group are configured in a right way I suppose (I can create new VMs via ruby).
Hi @xenuser, I got similar errors few days ago. I think there has been some updates with the python Azure sdk packages when using Centos for the Salt master. I'm curious what you get with pip freeze | grep azure
. Using these Azure packages worked for me. Perhaps you can give it a try.
@ritazh, I believe you are correct. Several of the packages you manually set the version for do NOT match the output I got, and I am also deploying on CentOS, CentOS7 to be specific.
azure==2.0.0 azure-batch==3.0.0 azure-common==1.1.8 azure-datalake-store==0.0.15 azure-graphrbac==0.30.0 azure-keyvault==0.3.6 azure-mgmt==1.0.0 azure-mgmt-authorization==0.30.0 azure-mgmt-batch==4.0.0 azure-mgmt-cdn==0.30.3 azure-mgmt-cognitiveservices==1.0.0 azure-mgmt-compute==1.0.0 azure-mgmt-containerregistry==0.2.1 azure-mgmt-datalake-analytics==0.1.6 azure-mgmt-datalake-nspkg==2.0.0 azure-mgmt-datalake-store==0.1.6 azure-mgmt-devtestlabs==2.0.0 azure-mgmt-dns==1.0.1 azure-mgmt-documentdb==0.1.3 azure-mgmt-iothub==0.2.2 azure-mgmt-keyvault==0.31.0 azure-mgmt-logic==2.1.0 azure-mgmt-monitor==0.2.1 azure-mgmt-network==1.0.0 azure-mgmt-nspkg==2.0.0 azure-mgmt-rdbms==0.1.0 azure-mgmt-redis==4.1.0 azure-mgmt-resource==1.1.0 azure-mgmt-scheduler==1.1.2 azure-mgmt-sql==0.5.3 azure-mgmt-storage==1.0.0 azure-mgmt-trafficmanager==0.30.0 azure-mgmt-web==0.32.0 azure-nspkg==2.0.0 azure-servicebus==0.21.1 azure-servicefabric==5.6.130 azure-servicemanagement-legacy==0.20.6 azure-storage==0.34.3 msrestazure==0.4.13
Has anyone here deployed vm with custom images on azure? Windows specifically
@saltstack/team-cloud might be able to help you out with your questions @sumeetisp
Also everyone here is this still occurring on 2017.7?
Any update on it. It seems no one has ever deployed on Azure using salt-cloud. I tried couple of times but same issue. Documentation is not helping anything. I guess multi cloud is not working fine with salt-cloud .
@nicholasmhughes can you help here?
Thanks! Daniel
@sam0104 , this is a very old issue and references a few problems. What "it" are looking for an update on?
If it's the inability to stand up instances without public IPs, please see this comment. Basically, the workaround is to set bootstrap_interface: private
for anything that won't have a public IP.
Also, please note that the Azure driver in even the latest release is still very old. The develop code is a lot better, and includes support for things like managed disks... but the Azure API is a moving target. The Salt code for accessing the API is not currently pinned to a specific API version, but we might want to consider it. Dynamically accounting for each possible API change is proving to be problematic. I have deployed extensively on Azure using Salt, so feel free to tag me in a separate issue if you encounter further problems.
Thanks Nicholas . I am in testing phase now for using Salt cloud for Azure and evaluating other tools too. Will create separate issue for Azure.
closing in favor of separate issues referenced above
Description of Issue/Question
Error when creating an instance on Azure with salt-cloud.
Setup
salt-cloud azure provider
salt-cloud azure profile
Steps to Reproduce Issue
I created 2 certificates:
I tested it with "requests (2.7.0)", "azure (1.0.2)" or "azure (1.0.3)", as I see as deps required in the doc: https://docs.saltstack.com/en/latest/topics/cloud/azure.html
Then I found this: https://docs.saltstack.com/en/latest/ref/clouds/all/salt.cloud.clouds.azurearm.html#module-salt.cloud.clouds.azurearm
and - after upgrading salt to 2016.11.1 - I tested it again with "azure (2.0.0rc5)", "azure-storage (0.32.0)", "requests (2.7.0)" or "requests (2.12.5)", as I see as deps required for this module:
I always receive the same error when I try to spin up an instance:
Versions Report
Any idea?
Thanks