I am trying to import a bacpac to azure sql database it runs for almost 2.5 hours, I need to get the status of this import job i.e. in-progress, complete etc using python. I know I can do it using Get-AzSqlDatabaseImportExportStatus -OperationstatusLink in powershell, but I want to do this using python.
Asked
Active
Viewed 90 times
1 Answers
1
You can use Python's subprocess
module to run Powershell commands.
The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes.
You can store the Powershell script in any file and then read that file using subprocess.Popen
method.
Example:
import subprocess, sys
p = subprocess.Popen(["powershell.exe",
"C:\\Project\\downloadSharePointFile.ps1"],
stdout=sys.stdout)
p.communicate()
Refer: Running Powershell script with Python, Executing PowerShell from Python

Utkarsh Pal
- 4,079
- 1
- 5
- 14