Azure / Azure/azure-cli

generate-sas expiry example doesn't work on official docker image

Open
#23,730 4 comments 0 reactions 1 assignee Claimed by @evelyn-ys View on GitHub
act-codegen-extensibility-squad Auto-Assign Azure CLI Team Customer Usage customer-reported question Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug
The following expiry example from [here](https://docs.microsoft.com/en-us/cli/azure/storage/container?view=azure-cli-latest#az-storage-container-generate-sas-examples) does not work on the official az cli docker image.
> ```
> end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
> sas=`az storage container generate-sas -n mycontainer --https-only --permissions dlrw --expiry $end -o tsv`
> az storage blob upload -n MyBlob -c mycontainer -f file.txt --sas-token $sas
> ```

**Command Name**
This issue relates to the `az storage container generate-sas` command, but the problem in the example is with the date command.

**Errors:**
```
docker run -it mcr.microsoft.com/azure-cli:latest bash
bash-5.1# end=`date -u -d "30 minutes" '+%Y-%m-%dT%H:%MZ'`
date: invalid date '30 minutes'
```

## To Reproduce:
See "Errors" section.

## Expected Behavior
I expect a date example that works on the official docker image.

## Environment Summary
```
Linux-5.10.25-linuxkit-x86_64-with, Alpine Linux v3.16
Python 3.10.5
Installer: DOCKER

azure-cli 2.39.0
```
## Additional Context
None

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.