Welcome to az_k8s_operations’s documentation!

Indices and tables

az_k8s_operations common

az_k8s_operations.common.checkUrl(url)[source]

check the return code of url

az_k8s_operations.common.create_keyvault(credential, tenant_id, subscription_id, resource_group_name, kv_name, location, sku, object_id)[source]

Create kv and give right to object id. It return kv url or ‘’

az_k8s_operations.common.generatePassword(stringLength=14)[source]

Generate a random string of letters, digits and special characters

az_k8s_operations.common.generateXlsxFromList(headers, listUrls, fileName)[source]

Generate xls file from a list

az_k8s_operations.common.getAllUrlAppGw(credentials, subscription, checkUrl)[source]

get All url from AppGw

az_k8s_operations.common.getAllUrlAppServ(credentials, subscription, checkUrl)[source]

get All url from AppServ

az_k8s_operations.common.getAllUrlNginx(credentials, subscription, rgName, vmName, SUBSCRIPTION_ID, rgname, accountname, sharename, checkUrl)[source]

get All url from Nginx vm (we use a tempory share to do run command and get result)=

az_k8s_operations.common.getResource(credentials, subscription_id, resource_group_name, resource_type)[source]

Get the resource object from resource group name, name and resource type

az_k8s_operations.common.getTagsFromRg(credentials, subscription_id, rgName)[source]

get Tags from resource group

az_k8s_operations.common.listDictToHtmlTable(listDict)[source]

return string containing html code for table

az_k8s_operations.common.read_template(filename)[source]

read template froma a file

az_k8s_operations.common.scanAthena(listSub, nginxList, azure_credential, SUBSCRIPTION_ID_pub, rgname_pub, accountname_pub, container_pub, SUBSCRIPTION_ID_temp, rgname_temp, accountname_temp, sharename_temp, checkUrl)[source]

get All url from Nginx vm, appserv, appgw , generate excel file and push it on blob container

az_k8s_operations.common.sendMail(SMTP_SERVER, SMTP_PORT, MY_ADDRESS, PASSWORD, Name, email, template, filename)[source]

function to send mail with attachment

az_k8s_operations.common.sendMailSendGrid(FROM, TO, SUBJECT, CONTENT, LISTFILENAME, API_KEY)[source]

Send Mail with send Grid

az_k8s_operations.common.setKeyvaultSecret(credential, vaultUrl, secretName, secretValue)[source]

Set a secret in a kleyvault i(create, update)

az_k8s_operations.common.uploadFile2Blob(accountname, accountkey, container, targetFileName, localFileName)[source]

upload file to a blob

az_k8s_operations spn

az_k8s_operations.spn.CreateKeyForSpnList(graph_credentials, TENANT_ID, nbDays, listSpn)[source]

Create Key (client secrets with expiration date). Return a list dict(SpnId: ,Name:,Secret:,EndDate:)

az_k8s_operations.spn.checkAllSpn(graph_credentials, TENANT_ID, nbDays)[source]

Get Spn key validity (which expires in x days. Required READALL on diectory on API graph Admin consent. Return a list dict(SpnId: ,KeyId: , EndDate: , ToLate:true|false|SOON )

az_k8s_operations.spn.checkKeyCreation(graph_credential, TENANT_ID, client_id, key_custom_name)[source]

iCheck if key_custom_name exist

az_k8s_operations.spn.checkKeys(listKeys, nbDays)[source]

check Keys

az_k8s_operations.spn.getObjectIdFromAppId(TENANT_ID, credential, app_id)[source]

Get object id from application client id

az_k8s_operations.spn.getSpnFromClientId(CLIENT, KEY, TENANT_ID, client_id)[source]

Get Spn from application client id

az_k8s_operations.spn.getSpnListWithNoClientSecrets(graph_credentials, TENANT_ID)[source]

Get Spn list with no client secrets (without expiration date). Required READALL on diectory on API graph Admin consent. Return a list dict(SpnId: ,Name:)

az_k8s_operations.spn.update_password_key(credentials, TENANT_ID, app_id, nbDays, keyName, action)[source]

Update password key of client ID which expires in x days (action : create|delete)

az_k8s_operations k8S

az_k8s_operations azdevops

az_k8s_operations.azdevops.getserviceendpoint(credentials, organization_url, project)[source]

Get service connection azure rm .

az_k8s_operations.azdevops.list_projects(credentials, organization_url)[source]

List Projects. Return list of projectName

az_k8s_operations.azdevops.listprojects(credentials, organization_url)[source]

List Project and service connection on this project. Just print to test

az_k8s_operations.azdevops.updateserviceendpointazurermcredential(credentials, organization_url, project, spnId, spnKey)[source]

Update service connection azure rm .

az_k8s_operations report

az_k8s_operations.report.getMySqlDetails(credentials, subscription, rgName, serverName)[source]

Retrieve dict containing Db details

az_k8s_operations.report.getPSqlDetails(credentials, subscription, rgName, serverName)[source]

Retrieve dict containing Db details

az_k8s_operations.report.getResourcesFromAppName(credentials, subscription, AppName)[source]

Retrieves a list of resources in Azure that contain a specific tag with a certain value. :param credentials: Credential to login. :param subscription_id: Subscription id. :param AppName: The AppName in CMDB. :return: A list of resources matching the tag criteria

az_k8s_operations.report.getSqlDetails(credentials, subscription, rgName, serverName)[source]

Retrieve dict containing Db details

az_k8s_operations.report.getVmDetails(credentials, subscription, rgName, vmName)[source]

Retrieve dict containing VM details

az_k8s_operations maintenance

az_k8s_operations.maintenance.get_kv_infra(azure_credential, graph_credential, tenant_id, subscription_id, resource_group_name, client_app_id)[source]

try to find kv infra in rg

az_k8s_operations.maintenance.rotateKeysForK8sCluster(azure_credential, graph_credential, azdevops_credential, TENANT_ID, subscription, resource_group_name, cluster_name, nbDays, organization_url)[source]

Rotate spn key of cluster and spn key for server rbac spn Find kv in Rg of cluster (if only one we take it if several we take one which contains ‘infra’ Update kv infra in rg Update service connection of linked azure devops project Delete old keys

az_k8s_operations.maintenance.update_service_connection_projects(credential, organization_url, spn_id, spn_key)[source]

Update all service connection of project which have spn_id as user