@@ -231,6 +231,7 @@ type CreatePageBlobInput struct {
231231 ImageURL string
232232 StorageAccountName string
233233 BootstrapIgnData []byte
234+ UserDelegatedSAS * sas.UserDelegationCredential
234235 ImageLength int64
235236 AuthType azic.AuthenticationType
236237 TokenCredential azcore.TokenCredential
@@ -245,7 +246,7 @@ type CreatePageBlobOutput struct {
245246}
246247
247248// CreatePageBlob creates a blob and uploads a file from a URL to it.
248- func CreatePageBlob (ctx context.Context , in * CreatePageBlobInput ) ( string , error ) {
249+ func CreatePageBlob (ctx context.Context , in * CreatePageBlobInput ) error {
249250 logrus .Debugf ("Getting page blob client" )
250251
251252 pageBlobClient , err := pageblob .NewClient (
@@ -258,19 +259,19 @@ func CreatePageBlob(ctx context.Context, in *CreatePageBlobInput) (string, error
258259 },
259260 )
260261 if err != nil {
261- return "" , fmt .Errorf ("failed to get page blob client: %w" , err )
262+ return fmt .Errorf ("failed to get page blob client: %w" , err )
262263 }
263264
264265 logrus .Debugf ("Creating Page blob and uploading image to it" )
265266 if in .ImageURL == "" {
266267 _ , err = pageBlobClient .Create (ctx , in .ImageLength , nil )
267268 if err != nil {
268- return "" , fmt .Errorf ("failed to create page blob with image contents: %w" , err )
269+ return fmt .Errorf ("failed to create page blob with image contents: %w" , err )
269270 }
270271 // This image (example: ignition shim) needs to be uploaded from a local file.
271272 err = doUploadPages (ctx , pageBlobClient , in .BootstrapIgnData , in .ImageLength )
272273 if err != nil {
273- return "" , fmt .Errorf ("failed to upload page blob image contents: %w" , err )
274+ return fmt .Errorf ("failed to upload page blob image contents: %w" , err )
274275 }
275276 } else {
276277 // This is used in terraform, not sure if it matters
@@ -282,26 +283,15 @@ func CreatePageBlob(ctx context.Context, in *CreatePageBlobInput) (string, error
282283 Metadata : metadata ,
283284 })
284285 if err != nil {
285- return "" , fmt .Errorf ("failed to create page blob with image URL: %w" , err )
286+ return fmt .Errorf ("failed to create page blob with image URL: %w" , err )
286287 }
287288
288289 err = doUploadPagesFromURL (ctx , pageBlobClient , in .ImageURL , in .ImageLength )
289290 if err != nil {
290- return "" , fmt .Errorf ("failed to upload page blob image from URL %s: %w" , in .ImageURL , err )
291+ return fmt .Errorf ("failed to upload page blob image from URL %s: %w" , in .ImageURL , err )
291292 }
292293 }
293-
294- // SAS not supported when using managed identity.
295- if in .AuthType == azic .ManagedIdentityAuth {
296- return pageBlobClient .URL (), nil
297- }
298-
299- // Is this addition OK for when CreatePageBlob() is called from InfraReady()
300- sasURL , err := pageBlobClient .GetSASURL (sas.BlobPermissions {Read : true }, time .Now ().Add (time .Minute * 60 ), & blob.GetSASURLOptions {})
301- if err != nil {
302- return "" , fmt .Errorf ("failed to get Page Blob SAS URL: %w" , err )
303- }
304- return sasURL , nil
294+ return nil
305295}
306296
307297func doUploadPages (ctx context.Context , pageBlobClient * pageblob.Client , imageData []byte , imageLength int64 ) error {
@@ -454,6 +444,7 @@ type CreateBlockBlobInput struct {
454444 CloudEnvironment aztypes.CloudEnvironment
455445 ContainerName string
456446 BlobName string
447+ UserDelegatedSAS * sas.UserDelegationCredential
457448 StorageSuffix string
458449 ARMEndpoint string
459450 Region string
@@ -512,12 +503,7 @@ func createBlockBlob(ctx context.Context, in *CreateBlockBlobInput, sharedKeyCre
512503 if in .AuthType == azic .ManagedIdentityAuth {
513504 return blockBlobClient .URL (), nil
514505 }
515-
516- sasURL , err := blockBlobClient .GetSASURL (sas.BlobPermissions {Read : true }, time .Now ().Add (time .Minute * 60 ), & blob.GetSASURLOptions {})
517- if err != nil {
518- return "" , fmt .Errorf ("failed to get SAS URL: %w" , err )
519- }
520- return sasURL , nil
506+ return "" , nil
521507}
522508
523509func createBlockBlobOnStack (ctx context.Context , in * CreateBlockBlobInput ) (string , error ) {
@@ -598,6 +584,7 @@ func uploadBlockBlobOnStack(in *CreateBlockBlobInput, key string) (string, error
598584 }
599585 return sas , nil
600586}
587+
601588// CustomerManagedKeyInput contains the input parameters for creating the
602589// customer managed key and identity.
603590type CustomerManagedKeyInput struct {
0 commit comments