Added changes for azure powershell login

This commit is contained in:
aksm-ms
2020-03-04 17:44:34 +05:30
parent bb25f4563b
commit 739c3386a1
4 changed files with 123 additions and 7 deletions

View File

@@ -21,12 +21,13 @@ const crypto = __importStar(require("crypto"));
const exec = __importStar(require("@actions/exec"));
const io = __importStar(require("@actions/io"));
const actions_secret_parser_1 = require("actions-secret-parser");
const loginAzurePowerShell_1 = require("./loginAzurePowerShell");
var azPath;
var prefix = !!process.env.AZURE_HTTP_USER_AGENT ? `${process.env.AZURE_HTTP_USER_AGENT}` : "";
function main() {
return __awaiter(this, void 0, void 0, function* () {
try {
// Set user agent varable
// Set user agent variable
let usrAgentRepo = crypto.createHash('sha256').update(`${process.env.GITHUB_REPOSITORY}`).digest('hex');
let actionName = 'AzureLogin';
let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS_${actionName}_${usrAgentRepo}`;
@@ -44,6 +45,7 @@ function main() {
}
yield executeAzCliCommand(`login --service-principal -u "${servicePrincipalId}" -p "${servicePrincipalKey}" --tenant "${tenantId}"`);
yield executeAzCliCommand(`account set --subscription "${subscriptionId}"`);
yield loginAzurePowerShell_1.initializeAz(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId);
console.log("Login successful.");
}
catch (error) {