https://pulumi.com logo
#general
Title
# general
n

nice-application-79035

01/25/2023, 12:25 AM
Hello, quick question on getting the azure blob sas token. Is it possible to configure the expiry_time dynamically (like 1 day orfew hours based on start time)?
Copy code
storage.list_storage_account_service_sas_output(account_name=account_name,
                                                           resource_group_name=resource_group_name,
                                                           permissions=storage.Permissions.R,
                                                           shared_access_start_time="2022-01-01T02:02:20Z",
                                                           shared_access_expiry_time="2025-01-01T02:02:20Z",
                                                           protocols=storage.HttpProtocol.HTTPS,
                                                           resource=storage.SignedResource.B,
                                                           canonicalized_resource=pulumi.Output.concat("/blob/",account_name,"/",container_name))
Right now, I have hard coded the
shared_access_expirty_time
.
m

melodic-tomato-39005

01/25/2023, 5:09 PM
Hey @nice-application-79035, it doesn’t seem like the API supports this directly. But you can create the start time as a
datetime
in your code, calculate the expiry time from that, and serialize both to a string. I’m not very fluent in Python but this page should have the docs: https://docs.python.org/3/library/datetime.html#timedelta-objects
6 Views