from azure.mgmt.compute import ComputeManagementClient
print("Starting script")
SUBSCRIPTION_ID = "mysubscriptionid"
credential = ClientSecretCredential(
tenant_id='mytenantid,
client_id='myapplicationid,
client_secret='myapplicationsecret'
)
compute_client = ComputeManagementClient(
credential=credential,
subscription_id=SUBSCRIPTION_ID,
)
print("Getting vms")
# List all Virtual Machines in the specified subscription
def list_virtual_machines():
for vm in compute_client.virtual_machines.list_all():
print(vm.name)
list_virtual_machines()
Errors encountered and fixes.
Packages not found
Solution :
Install the packages using
pip install packagename
pip error while installing packages.
pip install azure-storage Defaulting to user installation because normal site-packages is not writeable WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1,
This is another way of putting SCOM Agents in maintenance mode.
I faced a problem with the earlier management pack wherein there was a rule running against the management servers. You can take a look at this approach in my earlier posts.
Whenever the rule failed to load, the agents failed to get in maintenance mode. This approach also takes into consideration the SCOM servers not being put in maintenance mode.
In the current approach I use the command notification channel together with the management pack rule for alerting on sccm reboot events and putting the agents in maintenance mode.
Create an alert in SCOM when a computer is rebooted by SCCM
Run a powershell script using command notifications channel to put the computer in maintenance mode.