Azure CLI : Commandes utiles pour inventaire
jeudi 14 février 2019
par
popularité : 7%
par
popularité : 7%
Commande pour connaîte la liste des VM et leur IP :
az vm list-ip-addresses -o table | tr -s ’ ’ ’ ;’
Commande pour connaîte la liste des VM ResourceGroup,Location,Zones :
az vm list -o table | tr -s ’ ’ ’ ;’
Script pour avoir une liste des VM et IP
create-inventaire.sh
# ! /bin/bash
# ! /bin/bash
#fichier avec la liste des VM
az vm list -o table | tr -s ’ ’ ’ ;’ | cut -d’ ;’ -f1,2 | sed ’1,2d’ > /tmp/listVM$$
FVM=/tmp/listVM$$
az vm list -o table | tr -s ’ ’ ’ ;’ | cut -d’ ;’ -f1,2 | sed ’1,2d’ > /tmp/listVM$$
FVM=/tmp/listVM$$
#fichier avec la liste des VM/IP
az vm list-ip-addresses -o table | tr -s ’ ’ ’ ;’ | sed ’1,2d’ > /tmp/listIP$$
FIP=/tmp/listIP$$
az vm list-ip-addresses -o table | tr -s ’ ’ ’ ;’ | sed ’1,2d’ > /tmp/listIP$$
FIP=/tmp/listIP$$
for var in $(cat $FVM )
do
VM=$(echo $var | cut -d’ ;’ -f1)
IP=$(grep $VM $FIP | cut -d’ ;’ -f2)
echo $var" ;"$IP
done
do
VM=$(echo $var | cut -d’ ;’ -f1)
IP=$(grep $VM $FIP | cut -d’ ;’ -f2)
echo $var" ;"$IP
done
cd /tmp
rm -f $FVM $FIP
exit 0
rm -f $FVM $FIP
exit 0
Option commande AZ :
Use az --version
to display the current version.
Here are the base commands :
account : Manage Azure subscription information. acr : Manage private registries with Azure Container Registries. acs : Manage Azure Container Services. ad : Manage Azure Active Directory Graph entities needed for Role Based Access Control. advisor : Manage Azure Advisor. aks : Manage Azure Kubernetes Services. ams : Manage Azure Media Services resources. appservice : Manage App Service plans. backup : Manage Azure Backups. batch : Manage Azure Batch. batchai : Manage Batch AI resources. billing : Manage Azure Billing. bot : Manage Microsoft Bot Services. cdn : Manage Azure Content Delivery Networks (CDNs). cloud : Manage registered Azure clouds. cognitiveservices : Manage Azure Cognitive Services accounts. configure : Manage Azure CLI configuration. This command is interactive. consumption : Manage consumption of Azure resources. container : Manage Azure Container Instances. cosmosdb : Manage Azure Cosmos DB database accounts. deployment : Manage Azure Resource Manager deployments at subscription scope. disk : Manage Azure Managed Disks. dla : (PREVIEW) Manage Data Lake Analytics accounts, jobs, and catalogs. dls : (PREVIEW) Manage Data Lake Store accounts and filesystems. dms : Manage Azure Data Migration Service (DMS) instances. eventgrid : Manage Azure Event Grid topics and subscriptions. eventhubs : Manage Azure Event Hubs namespaces, eventhubs, consumergroups and georecovery configurations - Alias. extension : Manage and update CLI extensions. feature : Manage resource provider features. feedback : Send feedback to the Azure CLI Team! find : Find Azure CLI commands. functionapp : Manage function apps. group : Manage resource groups and template deployments. hdinsight : Manage HDInsight resources. identity : Managed Service Identities. image : Manage custom virtual machine images. interactive : Start interactive mode. Installs the Interactive extension if not installed already. iot : Manage Internet of Things (IoT) assets. iotcentral : Manage IoT Central assets. keyvault : Manage KeyVault keys, secrets, and certificates. kusto : Manage Azure Kusto resources. lab : Manage Azure DevTest Labs. lock : Manage Azure locks. login : Log in to Azure. logout : Log out to remove access to Azure subscriptions. managedapp : Manage template solutions provided and maintained by Independent Software Vendors (ISVs). maps : Manage Azure Maps. mariadb : Manage Azure Database for MariaDB servers. monitor : Manage the Azure Monitor Service. mysql : Manage Azure Database for MySQL servers. network : Manage Azure Network resources. openshift : (PREVIEW) Manage Azure OpenShift Services. policy : Manage resource policies. postgres : Manage Azure Database for PostgreSQL servers. provider : Manage resource providers. redis : Manage dedicated Redis caches for your Azure applications. relay : Manage Azure Relay Service namespaces, WCF relays, hybrid connections, and rules. reservations : Manage Azure Reservations. resource : Manage Azure resources. role : Manage user roles for access control with Azure Active Directory and service principals. search : Manage Azure Search services, admin keys and query keys. security : Manage your security posture with Azure Security Center. servicebus : Manage Azure Service Bus namespaces, queues, topics, subscriptions, rules and geo-disaster recovery configuration alias. sf : Manage and administer Azure Service Fabric clusters. sig : Manage shared image gallery. signalr : Manage Azure SignalR Service. snapshot : Manage point-in-time copies of managed disks, native blobs, or other snapshots. sql : Manage Azure SQL Databases and Data Warehouses. storage : Manage Azure Cloud Storage resources. tag : Manage resource tags. vm : Manage Linux or Windows virtual machines. vmss : Manage groupings of virtual machines in an Azure Virtual Machine Scale Set(VMSS). webapp : Manage web apps.