python
2 TopicsAzure Logic App - Slow Performance with Docker Containers/Python
I have a python script that uses an adobe api to fetch web traffic analytics reports and write them to an Azure SQL database. This script takes about 10 minutes to run and complete successfully when run on my local machine. I packaged this up in to a docker container and have the container configured to run in our Azure logic app as seen in the photo. I have the time limit for the container running set to 3 hours (limit setting in the Until loop) and looking at the logs the script gets nowhere near completion. Why do I see such poor performance when running the container in the logic app vs. my local machine? Are there ways to increase resources for logic apps? Any ideas would help, thanks.1.9KViews1like0CommentsAzure Automation VM Start and Stop in Python runbook
Hello , We are trying to do VM Start and Stop by using Python. And we did for single VM and we tested it in Azure Portal, It was successfully done both start and stop. Now we have to do for Multiple VMS, start and stop. Can anyone please help us to do for multiple VMS, start and stop in Python. Please find the attached script for the single VM. source from - https://docs.microsoft.com/en-us/azure/automation/automation-first-runbook-textual-python2 Python Script: import os import traceback import os import sys from azure.mgmt.compute import ComputeManagementClient import azure.mgmt.resource import automationassets def get_automation_runas_credential(runas_connection): from OpenSSL import crypto import binascii from msrestazure import azure_active_directory import adal # Get the Azure Automation RunAs service principal certificate cert = automationassets.get_automation_certificate("AzureRunAsCertificate") pks12_cert = crypto.load_pkcs12(cert) pem_pkey = crypto.dump_privatekey(crypto.FILETYPE_PEM,pks12_cert.get_privatekey()) # Get run as connection information for the Azure Automation service principal application_id = runas_connection["ApplicationId"] thumbprint = runas_connection["CertificateThumbprint"] tenant_id = runas_connection["TenantId"] # Authenticate with service principal certificate resource ="https://management.core.windows.net/" authority_url = ("https://login.microsoftonline.com/"+tenant_id) context = adal.AuthenticationContext(authority_url) return azure_active_directory.AdalAuthentication( lambda: context.acquire_token_with_client_certificate( resource, application_id, pem_pkey, thumbprint) ) # Authenticate to Azure using the Azure Automation RunAs service principal runas_connection = automationassets.get_automation_connection("AzureRunAsConnection") azure_credential = get_automation_runas_credential(runas_connection) # Initialize the compute management client with the RunAs credential and specify the subscription to work against. compute_client = ComputeManagementClient( azure_credential, str(runas_connection["SubscriptionId"]) ) # Resource Group resource_group_name = str(sys.argv[1]) vm_name = str(sys.argv[2]) # Start the VM print('\nStart VM') async_vm_start = compute_client.virtual_machines.start(resource_group_name, vm_name) async_vm_start.wait() In the below mentioned screen shot, if we enter the multiple parameter/VM name, it is taking only the first name (parameter/VM name) Please Suggest.11KViews0likes0Comments