Last active
September 12, 2023 15:41
-
-
Save devna13/12e4fc1df87016c6cab2013ac66d1170 to your computer and use it in GitHub Desktop.
Activate https://portal.azure.com/ PIM via TamperMonkey script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Role activate | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://portal.azure.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=azure.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
console.log("************** HERE AZ ROLE ***********"); | |
setTimeout(() => { | |
activateRole('role-2'); | |
}, 3000); | |
setTimeout(() => { | |
activateRole('role-1'); | |
}, 5000); | |
function activateRole(roleName){ | |
console.log("Activating: " + roleName); | |
var found = $("tr:contains('"+ roleName+"') td:last-child a"); | |
if (!found) { | |
console.log("role table not found."); | |
return; | |
} | |
found[0].click(); | |
setTimeout(() => { | |
console.log(" Time out..."); | |
var txtArea = $(".azc-textarea.azc-input"); | |
if (!txtArea) { | |
console.log(" text area not found."); | |
return; | |
} | |
//var form= txtArea.closest("form"); | |
//console.log('form', form); | |
txtArea.on("input", function() { | |
console.log(" Dirty call back..."); | |
$(this).data("dirty", true); | |
$("div[title='Activate']").click(); | |
}); | |
txtArea.val("Monitoring"); | |
txtArea.trigger('input'); | |
}, 4000); | |
// Your code here... | |
} | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment