Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
Remove app id uris (#228) (#231)
Browse files Browse the repository at this point in the history
* changes for removing app id uris

* changelog typo

* revertig to v1.2.3 since it has not been released
  • Loading branch information
tejasd1990 authored Jul 22, 2021
1 parent 4468808 commit 93995ed
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 48 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). Versionin
### Updated
- Moved Simple web app and python linux web app to use remote provisioning.
- Bug fixes
- Removed app id uris being set through the `identifierUris` field while creating the aad app

## 1.2.2
### Updated
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@
"extensionDependencies": [
"ms-vscode.azure-account"
]
}
}
89 changes: 43 additions & 46 deletions src/configure/helper/graphHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,44 @@ export class GraphHelper {
var aadApp: AadApplication;

return this.createAadApp(graphClient, aadAppName, tenantId)
.then((aadApplication) => {
aadApp = aadApplication;
return this.createSpn(graphClient, aadApp.appId, tenantId);
})
.then((spn) => {
aadApp.objectId = spn.objectId;
return this.createRoleAssignment(session.credentials, scope, aadApp.objectId);
})
.then(() => {
return aadApp;
})
.catch((error) => {
let errorMessage = "";

if (typeof error == "string") {
errorMessage = error;
}
else {
errorMessage = !!error && error.message;
if (!errorMessage && error["odata.error"]) {
if (typeof error["odata.error"]["message"] === "object") {
errorMessage = error["odata.error"]["message"].value;
}
else {
errorMessage = error["odata.error"]["message"];
}
.then((aadApplication) => {
aadApp = aadApplication;
return this.createSpn(graphClient, aadApp.appId, tenantId);
})
.then((spn) => {
aadApp.objectId = spn.objectId;
return this.createRoleAssignment(session.credentials, scope, aadApp.objectId);
})
.then(() => {
return aadApp;
})
.catch((error) => {
let errorMessage = "";

if (typeof error == "string") {
errorMessage = error;
}
if (!errorMessage) {
try {
errorMessage = JSON.stringify(error);
else {
errorMessage = !!error && error.message;
if (!errorMessage && error["odata.error"]) {
if (typeof error["odata.error"]["message"] === "object") {
errorMessage = error["odata.error"]["message"].value;
}
else {
errorMessage = error["odata.error"]["message"];
}
}
catch (err) {
if (!errorMessage) {
try {
errorMessage = JSON.stringify(error);
}
catch (err) {

}
}
}
}
throw new Error(errorMessage);
});
throw new Error(errorMessage);
});
}

public static generateAadApplicationName(accountName: string, projectName: string): string {
Expand Down Expand Up @@ -84,10 +84,10 @@ export class GraphHelper {
return accountName + "-" + projectName + "-" + guid;
}

public static async getAccessToken(session: AzureSession): Promise<string>{
const token = await this.getRefreshToken(session);
return token.accessToken;
}
public static async getAccessToken(session: AzureSession): Promise<string> {
const token = await this.getRefreshToken(session);
return token.accessToken;
}

private static contributorRoleId = "b24988ac-6180-42a0-ab88-20f7382dd24c";
private static retryTimeIntervalInSec = 2;
Expand Down Expand Up @@ -149,9 +149,6 @@ export class GraphHelper {
"availableToOtherTenants": false,
"displayName": name,
"homepage": "https://" + name,
"identifierUris": [
"https://" + name
],
"passwordCredentials": [
{
"startDate": startDate,
Expand All @@ -163,12 +160,12 @@ export class GraphHelper {
deserializationMapper: null,
serializationMapper: null
})
.then((data) => {
return <AadApplication>{
appId: data.appId,
secret: secret
};
});
.then((data) => {
return <AadApplication>{
appId: data.appId,
secret: secret
};
});
}

private static async createSpn(graphClient: RestClient, appId: string, tenantId: string): Promise<any> {
Expand Down

0 comments on commit 93995ed

Please sign in to comment.