I am trying to automate my logic app creation process using azure-sdk-for-python.
Here's my python script.
import schedule
import time
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.logic import LogicManagementClient
def create_logic_app(iteration):
subscription_id = '' # replace with your Azure subscription ID
resource_group_name = '' # replace with your resource group name
logic_app_name = f'Twa_{iteration}' # Unique name for each Logic App
location = 'East US' # Azure region
credential = DefaultAzureCredential()
resource_client = ResourceManagementClient(credential, subscription_id)
logic_client = LogicManagementClient(credential, subscription_id)
print("Creating/Updating resource group...")
resource_client.resource_groups.create_or_update(resource_group_name, {'location': location})
logic_app_parameters = {
'location': location,
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose": {
"inputs": "Insert logic",
"runAfter": {},
"type": "Compose"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"triggers": {
"Recurrence": {
"recurrence": {
"frequency": "Minute",
"interval": 3
},
"type": "Recurrence"
}
}
},
"kind": "Stateful"
}
# Additional parameters here
}
print(f"Creating/Updating Logic App: {logic_app_name}...")
logic_client.workflows.create_or_update(resource_group_name, logic_app_name, logic_app_parameters)
print(f"Logic App {logic_app_name} created/updated successfully.")
def job():
for i in range(10):
create_logic_app(i)
create_logic_app("recurrence")
The current script is creating logic apps with a plan-type: consumption. I want to create logic apps with a Plan-type: Standard.
How can I achieve that?
The current script is creating logic apps with a plan-type: consumption. I want to create logic apps with a Plan-type: Standard.
I agree with Skin's comment, it may not be possible to use the SDK, so you’d need to use REST calls
or Azure CLI
commands to create a standard plan type.
You can refer to this MS-document. As of now, you can use the Azure CLI commands is an easy way to create logic apps with standard plan type.
Command:
az logicapp create -g <your-resource-group> --subscription <your-subscription-id> -p "<plan name or resource Id of app service plan>" -n myLogicApp3261 -s <storage account name>
Output:
PS /home/xxx> az logicapp create -g <your-resource-group> --subscription <your-subscription-id> -p "<plan name or resource Id of app service plan>" -n myLogicApp3261 -s <storage account name>
Application Insights "myLogicApp3261" was
{
"availabilityState": "Normal",
"clientAffinityEnabled": false,
"clientCertEnabled": false,
"clientCertExclusionPaths": null,
"clientCertMode": "Required",
"cloningInfo": null,
"containerSize": 1536,
"customDomainVerificationId": "A18xxxx0034F7C3E60zzzzzzz3",
"dailyMemoryTimeQuota": 0,
"defaultHostName": "mylogicapp3261.azurewebsites.net",
"enabled": true,
"enabledHostNames": [
"mylogicapp3261.azurewebsites.net",
"mylogicapp3261.scm.azurewebsites.net"
],
Portal:
Reference: