Exemple #1
0
 def apps(self):
     if self.app.pargs.all:
         self.app.log.info("Show All Applications for the Account")
         os_agent = OSAgent()
         pprint(azure_get_apps(os_agent), indent=4)
     else:
         self.app.log.info("Show Applications owned by this User")
         os_agent = OSAgent()
         pprint(azure_show_apps(os_agent), indent=4)
Exemple #2
0
 def sps(self):
     if self.app.pargs.all:
         self.app.log.info("Show All Service Principals for the account")
         os_agent = OSAgent()
         pprint(azure_get_service_principals(os_agent), indent=4)
     else:
         self.app.log.info("Show Service Principals for this user")
         os_agent = OSAgent()
         pprint(azure_show_service_principals(os_agent), indent=4)
Exemple #3
0
    def delete(self):
        self.app.log.info("Deleting creds for this subscription")
        os_agent = OSAgent()

        if not app.pargs.app_name:
            print("-n|--app_name <name> must be specified for delete")
        else:
            azure_delete_cred_elements(os_agent, app.pargs.app_name)
Exemple #4
0
 def show(self):
     self.app.log.info("Show your current credentials")
     os_agent = OSAgent()
     creds = load_config(os_agent)
     if not creds:
         print("Creds have not been created for this subscription. Please run the create step")
     else:
         print("\nYour current Azure Credentials:")
         pprint(creds, indent=4)
Exemple #5
0
 def show(self):
     self.app.log.info("Show your current credentials")
     os_agent = OSAgent()
     creds = load_config(os_agent)
     if not creds:
         print(
             "Creds have not been created for this subscription. Please run the create step"
         )
     else:
         print("\nYour current Azure Credentials:")
         for app, crds in creds.items():
             print("APP : ", app)
             for k, v in crds.items():
                 print("export {0}={1}".format(k, v))
Exemple #6
0
    def create(self):
        self.app.log.info("Creating creds for this subscription")
        os_agent = OSAgent()

        if not app.pargs.app_name or not app.pargs.password or not app.pargs.basename:
            print("-n|--app_name <name> -p|--password -b|basename are mandatory for a create")
        else:
            creds = create_cred_elements(os_agent,
                                         app.pargs.app_name,
                                         app.pargs.basename,
                                         azure_get_subscription_id(os_agent),
                                         app.pargs.password)
            print("Now saving the credentials")
            orig = load_config(os_agent)
            creds.update(orig)
            save_config(creds, os_agent)
Exemple #7
0
 def login(self):
     os_agent = OSAgent()
     self.app.log.info("Verify the User has logged into the Azure CLI")
     azure_login(os_agent)
     self.app.log.info("Setting the Azure Subscription ID")
     subscription_id = azure_set_account(os_agent)
Exemple #8
0
 def install(self):
     self.app.log.info("Installing the azure CLI")
     os_agent = OSAgent()
     azure_cli_installed(os_agent)