in src/publishers/websiteRunFromPackageDeploy.ts [15:49]
public static async execute(state: StateConstant, context: IActionContext) {
let blobServiceClient: BlobServiceClient;
if (context.appSettings.AzureWebJobsStorage) {
Logger.Info("Using AzureWebJobsStorage for Blob access.");
blobServiceClient = BlobServiceClient.fromConnectionString(context.appSettings.AzureWebJobsStorage);
} else {
Logger.Info("Using AzureWebJobsStorage__accountName and RBAC for Blob access.");
blobServiceClient = new BlobServiceClient(
`https://${context.appSettings.AzureWebJobsStorage__accountName}.blob.core.windows.net`,
new DefaultAzureCredential()
);
}
const containerClient: ContainerClient = blobServiceClient.getContainerClient(ConfigurationConstant.BlobContainerName);
await containerClient.createIfNotExists();
const blobName: string = this.createBlobName();
let blockBlobClient: BlockBlobClient = containerClient.getBlockBlobClient(blobName);
await blockBlobClient.uploadFile(context.publishContentPath);
const packageUrl: string = blockBlobClient.url;
core.setOutput(ConfigurationConstant.ParamOutPackageUrl, packageUrl);
let bobUrl: string;
if (context.appSettings.AzureWebJobsStorage) {
Logger.Info("Package Url will use SAS.");
bobUrl = await this.getBlobSasUrl(blockBlobClient);
} else {
if (context.appSettings.WEBSITE_RUN_FROM_PACKAGE_BLOB_MI_RESOURCE_ID) {
Logger.Info("Package Url will use RBAC with User-assigned managed identity because WEBSITE_RUN_FROM_PACKAGE_BLOB_MI_RESOURCE_ID app setting is present.");
} else {
Logger.Info("Package Url will use RBAC with System-assigned managed identity.");
}
bobUrl = packageUrl;
}
await this.publishToFunctionapp(state, context.appService, bobUrl);
}