NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.85k stars 365 forks source link

nixops for azure broken on 17.09 and unstable #766

Open jbgi opened 6 years ago

jbgi commented 6 years ago

Azure deployment does not work anymore because of some changes in the new version of the adal python lib packaged for 17.09+ .

It looks access to functions acquire_token_with_client_credentials/acquire_token_with_username_password needs a different import: error: 'module' object has no attribute 'acquire_token_with_username_password' at https://github.com/NixOS/nixops/blob/ab5256aec4d5cb06e3142ce011c95459736642b2/nixops/azure_common.py#L275

Bountysource

pvgoran commented 6 years ago

Authenticating via service principal doesn't work as well (a similar message about the acquire_token_with_username_password attribute is shown).

This is a huge problem, and it wasn't addressed in any way for more than a month. Is NixOps even maintained?..

hyphon81 commented 6 years ago

It seems adal.acquire_token_with_username_password is wrong. For example,

context = adal.AuthenticationContext(self.authority_url)
context.acquire_token_with_username_password

is right. https://github.com/NixOS/nixops/blob/ab5256aec4d5cb06e3142ce011c95459736642b2/nixops/azure_common.py#L275-L278

However, acquire_token_with_username_password required the OAuth client id. https://github.com/AzureAD/azure-activedirectory-library-for-python/blob/a73579d84983012e546c26d308d4894590c9fea5/adal/authentication_context.py#L133

And, Microsoft doesn't recommended auth with username and password, so, I think, on NixOps codes, it needs to reconsider authentication method for Azure and nix expressions for deploying to Azure. https://github.com/AzureAD/azure-activedirectory-library-for-python/issues/50 https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-authentication-scenarios

hyphon81 commented 6 years ago

Now, if we use Azure with NixOps, we should prepare the web app server for authentication. https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-authentication-scenarios

Marqin commented 5 years ago

Is it working now after #853 got merged?