Revoke ArcGIS Urban Suite license

187
3
Jump to solution
03-17-2022 09:00 AM
SvenHarpering1
Esri Contributor

Hi,

does anyone have a clue how I can revoke an ArcGIS Urban Suite license via the ArcGIS API for Python? My Script works for ArcGIS Pro,  ArcGIS Insights, etc., but not for the ArcGIS Urban Suite. Here is my code...

First part: List all licenses from my Named User:

for prov in currentUser.provisions:
    print(prov.title)

 

The result is:

Classic Story Maps
ArcGIS QuickCapture Web Designer
ArcGIS Dashboards
ArcGIS Pro
ArcGIS for SharePoint
ArcGIS for Office
ArcGIS Hub
ArcGIS for Power BI
ArcGIS Collector
ArcGIS Insights
ArcGIS Survey123
ArcGIS Online
ArcGIS Online Web App
ArcGIS Urban
ArcGIS Drone2Map
ArcGIS Experience Builder
ArcGIS Workforce
ArcGIS Web AppBuilder
ArcGIS StoryMaps
ArcGIS Tracker
ArcGIS AppStudio
ArcGIS QuickCapture
ArcGIS Navigator
ArcGIS Dashboards
ArcGIS CityEngine
ArcGIS Runtime Standard

 

As you can see, no ArcGIS Urban Suite is listed although my user has such a license. Afterwards I was checking which licenses are avaiable in the subscription:

gis_verbindung.admin.license.all()

 

The result here:

[<ArcGIS Insights License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS Pro License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS Drone2Map License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS Image for ArcGIS Online License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS GeoBIM License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS for Power BI License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS GeoPlanner License at https://www.arcgis.com/sharing/rest/>,
 <License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS AppStudio License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS Drone2Map License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS Community Analyst License at https://www.arcgis.com/sharing/rest/>,
 <Runtime Analysis  License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS Navigator License at https://www.arcgis.com/sharing/rest/>,
 <Admin Tools for ArcGIS Online License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS Tracker License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS Business Analyst Web and Mobile Apps License at https://www.arcgis.com/sharing/rest/>,
 <ArcGIS CityEngine License at https://www.arcgis.com/sharing/rest/>]

 

Also here no ArcGIS Urban Suite. Normally I would now use this code to revoke a license:

pro_license = gis_verbindung.admin.license.get('ArcGIS Urban')
pro_license.revoke(username=currentUser.username, entitlements="*")

 

It works for every license listed above, but how can I revoke an ArcGIS Urban Suite-license?

Any hint is appreciatet :).

 

Best

Sven

0 Kudos
1 Solution

Accepted Solutions
MJBiazar
Esri Contributor

Hi @SvenHarpering1 , 

admin.license.all() returns all the individual licenses in your org and from there you should be able to assign/revoke them. However, some app licenses (including ArcGIS Urban) are considered app bundle licenses. To query these licenses for your org, you can use license.bundles function. 

Below is a sample script that revokes all types of licenses from users on a list:

#Import modules and functions
from arcgis.gis import GIS
from arcgis.gis.admin import AGOLAdminManager

#Sign in to portal as admin
gis = GIS(PORTAL_URL, ADMIN_USERNAME, ADMIN_PASSWORD)

#Define license manager and find org licenses and app bundles
org_licenses=gis.admin.license.all()
org_bundles=gis.admin.license.bundles

#Revoke licenses from a list of users
usernames=['USERNAME1','USERNAME2']
for username in usernames:
    for license in org_licenses:
        try:
            license.revoke(username=username, entitlements='*')
        except:
            pass
    print(f'All licenses for "{username}" were revoked!')

    for bundle in org_bundles:
        try:
            bundle.revoke(username)
        except:
            pass
    print(f'All app bundle licenses for "{username}" were revoked!')

 

Best,

MJ

View solution in original post

3 Replies
MJBiazar
Esri Contributor

Hi @SvenHarpering1 , 

admin.license.all() returns all the individual licenses in your org and from there you should be able to assign/revoke them. However, some app licenses (including ArcGIS Urban) are considered app bundle licenses. To query these licenses for your org, you can use license.bundles function. 

Below is a sample script that revokes all types of licenses from users on a list:

#Import modules and functions
from arcgis.gis import GIS
from arcgis.gis.admin import AGOLAdminManager

#Sign in to portal as admin
gis = GIS(PORTAL_URL, ADMIN_USERNAME, ADMIN_PASSWORD)

#Define license manager and find org licenses and app bundles
org_licenses=gis.admin.license.all()
org_bundles=gis.admin.license.bundles

#Revoke licenses from a list of users
usernames=['USERNAME1','USERNAME2']
for username in usernames:
    for license in org_licenses:
        try:
            license.revoke(username=username, entitlements='*')
        except:
            pass
    print(f'All licenses for "{username}" were revoked!')

    for bundle in org_bundles:
        try:
            bundle.revoke(username)
        except:
            pass
    print(f'All app bundle licenses for "{username}" were revoked!')

 

Best,

MJ

SvenHarpering1
Esri Contributor

@MJBiazar, thank you! Works perfectly :).

0 Kudos
MJBiazar
Esri Contributor

@SvenHarpering1 Fantastic! I'm glad that it worked for you too. 

0 Kudos