I am playing with the vSphere API and it worked good over the Web Interface, now I would like to write a Python Script that communicates with the API and give me some answers to my question like how many VM´s do I have in my Environment or which VM is currently running, for that I need to pass my Username and password to enter the vCenter, and ask the vCenter this questions, have somebody already did it this? and have the code for me or somebody a idea for fixing this problem?
Are you using an SDK to connect to the vCenter server?
vSphere Automation SDK for Python guide - Authentication: https://code.vmware.com/docs/7327/vmware-vsphere-automation-sdks-programming-guide-6-7-update-1#/doc/GUID-FBE84F97-5AAC-4D08-9727-299CCC22C300.html
pyvmomi SDK - Sample to retrieve VMs: https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/get_vm_names.py
Here's a sample to use Python to interact directly with the REST service, instead of an SDK: https://blog.dchidell.com/2016/11/23/vcenter-6-5-rest-api-w-python/
Related
I'm currently trying to develop an application to use ms-graph API using python.
I'm trying to use SSO authentication but I cant find any resources or documentation related.
I found this documentation https://learn.microsoft.com/en-us/office/dev/add-ins/develop/sso-in-office-add-ins
but it is only for javascript.
I wrote a script using Flask and another script using O365 python package.
It doesnt seem like its a Single sign on application that I try to achieve...
I'm looking for any documentation that could help.
You are referring to the Office web add-ins where you could also use SSO. But it seems you are developing a standalone application where Graph API is used. In that case you may find the Configure SAML-based single sign-on for your application using the Microsoft Graph API tutorial helpful.
I'm trying to create a Web Job on Azure (I have a student account) but the option is greyed out whenever I create a Web App, does anyone know why? I'm aiming to host a Discord bot I wrote on there, although it uses various Python packages and SQLite3 so I'm not sure if it'd even work. If anyone has any other hosting alternatives I'd appreciate suggestions!
WebJob feature is only support in Azure WebApp for Windows, not for Linux on Container.
Also note that Student Subscription will have limited services enabled.
My teacher asked me to implement a client-server based application using python. It's also required to have a cloud server, which obviously should be compatible with python. Any recommendations,software,help?
Here is the link to a client/server chat program in Python3. https://github.com/ipal0/Chat
You can put the server program in cloud and client program in your local computer. Hope this helps.
In AWS, you can assign a role to a VM, which then authorizes the instance when it makes queries to the AWS SDK. I am looking for similar functionality in Azure, or something that would enable me to do close to that.
I found this post which suggests that this is not possible in the way AWS does it. Are there any workarounds for this? I really don't want the system administrator to have to login to the instance and give their Azure Active Directory credentials to authorize it.
Excellent question :). I would suggest to wait a few days, we have something in progress that seems to fit your need. I created this issue for tracking.
The most simple would be to create a Service Principal credentials for these VMs. To do that, execute a post deployment script to install the CLI and "az ad sp create-for-rbac --sdk-auth >~/mycredentials.json". Then, you can start SDK script reading this credential file.
The "create-for-rbac" commands already exists if you want to look at it (--sdk-auth is the new option coming), so you can see that you can specify all scope and permissions needed in this command.
(I own the Azure SDK for Python at MS)
Would it be possible for some type of Python script to check services running on a linux box, and integrate with a google app script, so it would then populate a google doc spreadsheet stating whther a service is running or not ?
Yes. You would need to authorize it the first time and implement oAuth from the script though. I strongly suggest that you switch to the Google Drive API.